The window load event
In earlier examples we needed to put the scriptA JavaScript program. in the body element to make sure that the window had loaded before the functions were called. One easy way to get a function to run is by using the onload
event for the window object in the Document Object Model. In this example we are assigning the function startFunction
as the event onload
.
Note:
Hints:
- undefined
1
2
window.onload = startFunction;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX