Skip to content
Advertisement

Tag: onload

When to use “window.onload”?

In JavaScript, when I want to run a script once when the page has loaded, should I use window.onload or just write the script? For example, if I want to have a pop-up, should I write (directly inside the <script> tag): Or: Both appear to run just after the page is loaded. What is the the difference? Answer window.onload just

this.name returns undefined in javascript

I am trying to remotely create an onclick for each <div> (to save typing time). Here is the window.onload() function: The name of every <div> is “flyingsheep” – this value was set by <div name=”flyingsheep”>. When I click the <div>, the iframe “game” takes me to the webpage “/games/undefined”. Answer This will work. the problem is corrected. just use :

why can’t i set window.onload in IE8?

I have the following function, which works fine in Firefox, but will do nothing in IE8 I want to open a webpage and immediately open the print dialogue. Answer If you have the hand on the page at url, place the call there. In the HTML, at the end of the BODY tag. Add a SCRIPT tag with your call

Advertisement