Run script after page load complete?

I’ve searched around for a while, but I can’t seem to find the syntax to do this, assuming there is one.

I have a page that allows users to print out maps generated by mapquest. If the user clicks the “Print” button (the one on the page) before the page has finished loading the maps, the print-outs will have errors appearing on them.

I’ve been talking with MapQuest about the issue, and I don’t think it’s anything they can fix on their end.

What I would like to do is create a script that unhides the “PRINT” button only after the page has finished loading.

Something like this:


if (pageloadcomplete) {
//unhide print button
}

I assume there’s a way to do that in Javascript, but i can’t find the syntax anywhere.

you could use the onload=“” attribute in the body tag, I believe.

The “onload” function runs javascript before the content section loads, as far as I know. I need a function that runs ONLY after the entire content page has finished loading. For example if I have a page with 50 images on it. I want to only run a javascript function after all 50 images are loaded.

The body onload event only triggers when the page has finished being loaded, which includes all of the images have completed downloading.