You are here: irt.org | FAQ | JavaScript | Print | Q347 [ previous next ]
The following works for me, although Netscape allows the user to cancel the print request for the built-in dialogue box, so adding a confirm box seems a tad excessive:
<SCRIPT LANGUAGE="JavaScript"><!-- function myPrint() { if (window.print) { if (confirm("Print Page?")) { window.print(); } } } //--></SCRIPT> <SCRIPT LANGUAGE="JavaScript"><!-- if (window.print) document.write('<FORM><INPUT TYPE="BUTTON" VALUE="Print" onClick="myPrint()"><\/FORM>'); //--></SCRIPT>