+ 1

In javascript can someone list and explain the available method()

Onload() Onmouseover()

12th Mar 2019, 8:23 AM
PrinceKay
PrinceKay - avatar
2 odpowiedzi
+ 6
onload is called when the element is loaded. onmouseover is called when the mouse is over the element.
12th Mar 2019, 8:56 AM
Rowsej
Rowsej - avatar
+ 6
https://code.sololearn.com/WJza8etjQUgv/?ref=app 1. It is wrong to add parentheses after onload and onmouseover. 2. Using on... to assign callback to events of elements is inflexible, because if you assign again, the latter one will overwrites the previous one. The addEventListener() method is always preferred, since this way allows adding multiple callback to the same event listener. 3. For mouseover, all element can have this event. However, for load, not all element has this event. As you see in my code demo for you, body and img has load event listener, p and html does not. 4. The sequence of loading is irrelevant to the sequence of the elements in the html codes. Instead, the callback runs when the content is loaded. That's why in the demo above, you should see imgTwoLoaded() runs before imgOneLoaded(). At last, bodyLoaded() runs because the load of body is defined as having loaded all elements.
12th Mar 2019, 9:38 AM
Gordon
Gordon - avatar