Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 28th, 2005, 05:44 PM
Friend of Wrox
 
Join Date: Jun 2004
Location: Montreal, Quebec, Canada.
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to print contents of IFrame when is it a frams


Hi,
I'm wondering what is wrong with my code. I've alrady used this function in an other application and it worked fine! The only difference with this new page is that he contents of the IFRAME is a frameset.

How can I have a button on my main page (calling to print the contents of the IFRAME which as stipulated above is a frameset) ?

Once again
Thanks for all your help,

Nancy

Reply With Quote
  #2 (permalink)  
Old March 29th, 2005, 09:46 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I've never tried to do this. Normally you need to focus on the iframe before calling the print function. I don't know if you can with this scenario.
Code:
var oFrame = window.frames["<iframeNameToPrint>"];
oFrame.focus();
oFrame.print();
--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old March 29th, 2005, 10:45 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Montreal, Quebec, Canada.
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Joe, But I believe I've already scripted the focus correctly. I worked for a moment ... sort of: It had printed the top frame of the frameset inside that IFRAME. But as you can read, it only did it once :-(

Here's the code:

**************************************

function myprint() {
window.parent.newsletter.focus();
window.print();
}

********************************

.....And the IFRAME containing the Frameset:

**************************************

<div id="CONTENT" style="position:relative; width:570px; height:475px; z-index:1; left: 192px; top: 20px;">

<iframe name="newsletter" src="newsletter.htm" width="570px" height="475px"></iframe>

</div>

**************************************

Does anyone know how to do this?

Thanks,
nancy
Reply With Quote
  #4 (permalink)  
Old March 29th, 2005, 10:47 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Montreal, Quebec, Canada.
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thought I might add the actual frameset (newsletter.htm) code too: Maybe I need to reference each frame, too, somehow?


***************************************

<frameset rows="140,*" frameborder="NO" border="0" framespacing="0">
  <frame src="news_header.htm" name="top" scrolling="NO" noresize >
  <frame src="news.htm" name="main" scrolling="Auto">
</frameset>

***************************************
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
values from one iframe to another iframe URGENT raaj Beginning PHP 2 February 27th, 2007 12:19 PM
to print datagrid contents josna VB.NET 6 January 13th, 2006 12:02 AM
changing two frams at the same time in NS nightshonour Javascript How-To 1 May 3rd, 2005 07:28 PM
how to print the contents of datagrid using vb.net kumarkaushal VB.NET 2002/2003 Basics 1 March 21st, 2005 01:15 AM
how can I refresh the contents of an iframe? nerssi Javascript How-To 2 November 4th, 2004 06:05 AM



All times are GMT -4. The time now is 09:47 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.