Solved

ATTN mplungjan: Print an HTML-page automatically

Posted on 1998-08-25
1
203 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 100 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
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:
The viewer will learn how to dynamically set the form action using jQuery.

815 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now