Print button with Frames

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have 4 frames in a page, and I am looking to print the contents of one of
the frames, with a Print button on another frame.

Murray had posted the following code as an answer to question. I used it and
is good to print the contents of the page with the button.

The question is what should I change to make it print a page on a particular
frame.

If there is another way to do this, I am ok too.

Thanks for the help.

**************here is the code***********
At the top of the page define this script

<script type="text/javascript">
function print_page(where){
var is_mac=(navigator.platform.indexOf("ac") != -1);
(document.all && is_mac)?
alert("Select \"Print\" from the menu") : where? where.window.print() :
window.print();
}
</script>

In the body include the following statement


<button onClick="print_page()">Print Page</button>
 
The page within the frame has to be selected in order to be printed by the browser.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 
Since the button is on a different frame, when I select the button I would
think the application automatically selects the page when this print button
is selected. I tried it, and that is exactly what happens.

I am looking to print the page that is in a frame different from the button.

In my case the button in on the "top" frame and the page that I would like
to print is in the "main" frame. I hope I have my terms correct. I am new to
FP.

Thanks

....Jose
 
When you click on the button, you are setting the browser focus to the page that the button is on,
not the page you want to print.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 
That is right.

Is there a way to get page I would like to print with the button on a
different page?

....Jose
 
I got this to work by adding the following line of code in the function

window.parent.framename.focus();

For framename PUT THE NAME OF THE FRAME

so the function script will look like this

<script type="text/javascript">
function print_page(where){
var is_mac=(navigator.platform.indexOf("ac") != -1);
(document.all && is_mac)?
alert("Select \"Print\" from the menu") : where? where.window.print() :
window.print();
window.parent.framename.focus();
}
</script>
 
Great, now you just to test it in all the various browsers / platforms.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 
Hopefully things will work. My users all use IE. I hope that makes things
better.

Thanks you both for replying and helping. Appreciate your assistance.

....Jose
 
Back
Top