Solved

ATTN mplungjan: Print an HTML-page automatically

Posted on 1998-08-25
1
209 Views
Last Modified: 2013-12-25
How do I automatically print an HTML-page (using JavaScript)?
0
Comment
Question by:mnprsd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Setting up LaraDock for Laravel

Learn how to set up LaraDock in a Laravel project - LaraDock gives us an easy way to run a Laravel application using Docker in a single command.

Question has a verified solution.

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

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
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:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

624 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