Click to See Complete Forum and Search --> : print onLoad


metallibanger
12-09-2003, 11:39 PM
Ok, this question came up on the html board, but I think it's better posed here... is there any way I can make a page print as soon as it's loaded? Here's the deal: I'd be making a webpage with a link called 'print' and it would open a new window that loads the page with the print onLoad command, getting around the fact that I can't just make a print button print anything except the currently loaded page.

Hope that made sense... if it didn't, just concentrate on the question at hand... can I make a page print on load?

Andy Oliphant
A&M Design Studios

Phil_work
12-09-2003, 11:47 PM
You should be able to write

<body onload="javascript:window.print()">

Whether or not it prints the whole page is another question, as far as Im aware onload is done before the page is completely loaded. Just with a simple test, it brought up the print dialogue. Im pretty sure that is what the window.print command does, it won't actually print the page automatically..

fredmv
12-11-2003, 05:18 AM
<script type="text/javascript">
//<![CDATA[
onload = print;
//]]>
</script>

metallibanger
12-12-2003, 04:34 PM
Originally posted by fredmv
<script type="text/javascript">
//<![CDATA[
onload = print;
//]]>
</script>

Awesome, I ended up using that. The site will be www.jonnywenino.com whenever he gets hosting, but for now it's up here (http://www.highdesertcustomwoodworking.com/jonny/index.html) for demo purposes if you want to see how I implimented that script. Thanks Fred!

Andy Oliphant
A&M Design Studios

fredmv
12-12-2003, 04:37 PM
No problem Andy. :D