Print button

Results 1 to 3 of 3

Thread: Print button

  1. #1
    Snuggie Guest

    Default Print button

    Hi,<BR><BR>Can anyone give me an idea on what code I should write that will make the page to get printed when a button is clicked?<BR><BR>Zanks.

  2. #2
    Skippie Guest

    Default Print button example

    &#060;SCRIPT LANGUAGE="JAVASCRIPT"&#062;<BR><BR> var nIE4Win; <BR> var nCanPrint;<BR> var printed;<BR><BR> <BR> printed = "no";<BR> if (window.print) <BR> nCanPrint = "yes";<BR> else nCanPrint = "no";<BR> <BR> var agt=navigator.userAgent.toLowerCase()<BR><BR> nVersion = parseInt(navigator.appVersion);<BR> nIE = (agt.indexOf("msie") != -1);<BR> nWin = ( (agt.indexOf("win")!=-1) &#124&#124 (agt.indexOf("16bit")!=-1) );<BR> nMac = (agt.indexOf("mac") != -1);<BR> nIE4Win = (nIE && (nVersion == 4) && nWin);<BR> <BR><BR> function doPrint()<BR> {<BR> if (nCanPrint == "yes")<BR> {<BR> printed="yes";<BR> window.print();<BR> }<BR> else if (nIE4Win)<BR> {<BR> printed="yes";<BR> IEPrint();<BR> }<BR> else if (nWin)<BR> alert("To print this image, click your browser&#039s Print button."); <BR> }<BR><BR>&#060;/SCRIPT&#062;<BR><BR><BR>&#060;SCRIPT LANGUAGE="vbscript"&#062;<BR><BR> Sub IEPrint()<BR> on error resume next<BR> Call browser.ExecWB(6,1)<BR> End Sub<BR><BR>&#060;/SCRIPT&#062;<BR><BR><BR><BR>HELLO WORLD!<BR><BR>&#060;FORM&#062;<BR> &#060;INPUT TYPE="BUTTON" VALUE="Print" onClick="doPrint()"&#062;<BR>&#060;/FORM&#062;<BR><BR><BR><BR><BR><BR><BR><BR>-- Skippie

  3. #3
    Snuggie Guest

    Default Thanks a ton Skippie.

    I shall try out the code and if I run into problems,. will make another posting and hopefully u&#039ll help me out.<BR><BR>Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts