Solved

BROWSER PRINT

Posted on 2000-02-18
4
233 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

679 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