change 'onload =' to 'addEventListener'