hi, how to use the window onload event on javascript.. for example i got a function and i want that function to execute during page load. any ideas is greatly appreciated... thanks...
cguan_77
8
Nearly a Posting Virtuoso
Recommended Answers
Jump to PostHere is a sample code:
<html> <head> <script type="text/javascript"> function load() { //Put your code here } </script> </head> <body onload="load()"> </body> </html>
Jump to PostThe best way to do it:
<html> <head> <title>Test Page</title> <script type="text/javascript">var myFunc = function() { alert("Hello World!"); }; window.onload = myFunc; </script> </head> <body> </body> </html>
All 5 Replies
codestips
0
Newbie Poster
essential
84
Posting Shark
Featured Poster
cguan_77
8
Nearly a Posting Virtuoso
JugglerDrummer
0
Junior Poster
koolhq
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.