Sagewire Logo

Problem with window.onload

4 Message(s) by 2 Author(s) originally posted in javascript


From: mouton Date:   Friday, April 06, 2007
Hello,

I am a beginner and I am trying this short script in an external js
file:

function print() {
alert("just a test");
}
windows.onload = print;

But popup box appears in the browser when I call my html page. What
am I doing wrong?

Thank you for your help.


From: mouton Date:   Friday, April 06, 2007
wrote in message:

Hello,
I am a beginner and I am trying this short script in an external js
file:
function print() {
alert("just a test");
}
windows.onload = print;



Ok I have finally seen my mistake: I had to write "window" and not
"windows".

This script shows the box now but this one doesn't:

window.onload = function() {
var test = "just a test";
alert(test);
}
and I don't understand why...


From: mouton Date:   Friday, April 06, 2007
wrote in message:
This script shows the box now but this one doesn't:
window.onload = function() {
var test = "just a test";
alert(test);
}
and I don't understand why...



I think there is something wrong with my system. I need to check
various points. No need to answer me now. If I cannot find what's
wrong I'll ask again. Thank you.


From: Mike Scirocco Date:   Wednesday, April 11, 2007
wrote in message:
wrote in message:
This script shows the box now but this one doesn't:

window.onload = function() {
var test = "just a test";
alert(test);
}
and I don't understand why...
I think there is something wrong with my system. I need to check
various points. No need to answer me now. If I cannot find what's
wrong I'll ask again. Thank you.



I've had trouble with window.onload not waiting until the page was fully
loaded, and this code has worked great every time I used. These two
pages explain it:

http://dean.edwards.name/weblog/2005/09/busted/
http://dean.edwards.name/weblog/2006/06/again/

Mike



Next Message: having trouble w/event listener to detect iframe close



Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional