Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ATTN mplungjan: Print an HTML-page automatically

Posted on 1998-08-25
1
Medium Priority
?
211 Views
Last Modified: 2013-12-25
How do I automatically print an HTML-page (using JavaScript)?
0
Comment
Question by:mnprsd
1 Comment
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 400 total points
ID: 1854569
This will put a button to print on the page:
       <object id=WBControl width=0 height=0
       classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></object>

       <SCRIPT LANGUAGE=VBScript><!-- //
          Sub VBPrint() On Error Resume Next
             WBControl.ExecWB 6,1
          End Sub
       // --></SCRIPT>
       <SCRIPT LANGUAGE=JavaScript><!-- //
          if (navigator.appName.indexOf('Microsoft') !=-1)
             document.write('<FORM><INPUT TYPE="BUTTON" ONCLICK="VBPrint()" value="Print"></FORM>');
          else if (self.print)
             document.write('<FORM><INPUT TYPE="BUTTON" ONCLICK="self.print()" value="Print"></FORM>');
       // --></SCRIPT>

To print without user interference, just put

       <SCRIPT LANGUAGE=JavaScript><!-- //
          if (navigator.appName.indexOf('Microsoft') !=-1) VBPrint();
          else if (self.print) self.print();
       // --></SCRIPT>

Michel
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question