Solved

ATTN mplungjan: Print an HTML-page automatically

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Problem to be resolved in this article Currently, development of website and web application can be done without writing thousands of lines of programming code by hand. Description This can be done through by using a open source framework such …
Read about why website design really matters in today's demanding market.
The viewer will learn how to count occurrences of each item in an array.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

760 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

18 Experts available now in Live!

Get 1:1 Help Now