Click to See Complete Forum and Search --> : Using a Print Button


wsmith
03-15-2003, 12:28 PM
I am working on a site that I need to make a calander of upcoming events and I would like to use a Print button, so viewers could print out the info. How do I make this work?

DoLordBoy
03-15-2003, 12:39 PM
<script language="Javascript1.2">
var message = "Print This Page";

function printpage() {
window.print();
}

document.write("<center><form><input type=button "
+"value=\""+message+"\" onClick=\"printpage()\"></form>

AdamGundry
03-15-2003, 01:00 PM
Why not just this?

<input type="button" value="Print This Page" onclick="window.print()">

Adam

DoLordBoy
03-15-2003, 01:06 PM
good point.

I just cut and pasted my code from a page on my site that I got from a javascript tutorial. Not sure why it wasted all that time, but I can't say I know much about programming aside from how to press Ctrl C and Ctrl V

wsmith
03-15-2003, 01:21 PM
Originally posted by AdamGundry
Why not just this?

<input type="button" value="Print This Page" onclick="window.print()">

Adam




Thanks Adam, I'll give it a try!