Questions tagged [onload-event]
221 questions
68
votes
12 answers
JavaScript event window.onload not triggered
I've got the following code in a website:
window.onload = resize;
window.onresize = resize;
function resize(){
heightWithoutHeader = (window.innerHeight - 85) + "px";
document.getElementById("main-table").style.height =…
user321068
61
votes
4 answers
iFrame onload JavaScript event
I have an iFrame, where I want to send a JavaScript command after loading.
My current code looks like this:

Peleke
- 891
- 2
- 10
- 23
61
votes
2 answers
What setup code should go in Form Constructors versus Form Load event?
For winforms applications I'm wondering what setup code should go in:
MainForm()
as opposed to
MainForm_Load(object sender, EventArgs e)
Are there any best practice guidelines here?

Greg
- 34,042
- 79
- 253
- 454
61
votes
7 answers
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