Solved

BROWSER PRINT

Posted on 2000-02-18
4
198 Views
Last Modified: 2010-04-09
I need to know how to enable a visitor to a page on my site, to print off the particular frame that the print button is in..  is this possible?  I.e. they have visted a page, it has some information in a particular frame that will be designed as "printer friendly", and they can just press a button and it prints that page off...
thanks...
0
Comment
Question by:euphoni
  • 4
4 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 2534845
Generally speaking, in the frame that is to be printed, do this:

<FORM>
<INPUT type='button' name='cmdPrint' value='Print' onClick='self.print();'>
</form>
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 2534860
The above should work as is in Netscape and IE5.
For IE4, you will have to include the print.js file.  See this site:
  http://msdn.microsoft.com/workshop/Author/script/DHTMLPRINT.asp

and download this file:

  http://msdn.microsoft.com/workshop/Author/script/print.js

Once you include print.js, a print button can be done for both NS and IE like this:

  <INPUT type='button' name='cmdPrint' value='Print' onClick='self.print()'>

For more examples see:
  http://msdn.microsoft.com/workshop/Author/script/samp1.htm
  http://msdn.microsoft.com/workshop/Author/script/samp2.htm
  http://msdn.microsoft.com/workshop/Author/script/samp3.htm
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 500 total points
ID: 2534877
(locking)

Also, if you want to put the print button in a different frame than the one to be printed, do this:

<FORM>
<INPUT type='button' name='cmdPrint' value='Print' onClick='top.NameOfTheFrameToBePrinted.print();'>
</form>
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 2542577
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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

743 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

13 Experts available now in Live!

Get 1:1 Help Now