Solved

BROWSER PRINT

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

832 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