Questions tagged [onload-event]
212 questions
60
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?
![](../../users/profiles/173520.webp)
Greg
- 31,898
- 75
- 232
- 424
55
votes
9 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
46
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:
![](../../users/profiles/257617.webp)
Peleke
- 705
- 2
- 7
- 18
42
votes
6 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