Printing other Frames

G

GodFoca

Hey all! I have a frameset with two frames, and want to have a button in one
frame call print() in the other one:

This is the layout:

<frameset rows="*,40" frameborder="NO" border="0" framespacing="0">
<frame src="..." name="pritableText">
<frame src="..." name="printButton" scrolling="NO" noresize>
</frameset>

And, in printButton, I got this code:

<a href="#" onClick="parent.printableText.focus();
parent.printableText.print();">Print the page</a>

However, nothing happens in Netscape (7.01) and Firefox (0.8), and in IE (6)
I get an "error in the script". However, I do not identify the error.

Does anyone have a clue onto what's happening?

Thanks in advance,
Nicolas Sanguinetti
 
K

kaeli

Hey all! I have a frameset with two frames, and want to have a button in one
frame call print() in the other one:
Does anyone have a clue onto what's happening?

Well, unless you typed wrong, you have a typo in your frameset.
<frame src="..." name="pritableText">
should be
name="printableText"
(missing 'n')

Also, I don't think you wanted the parent of the anchor, yet I think
that's what your code is doing.
<a href="#" onClick="parent.printableText.focus();
parent.printableText.print();">Print the page</a>

Try this instead
<a href="#" onClick="window.parent.printableText.focus();
window.parent.printableText.print();">Print the page</a>

Note that I don't think that's cross browser. If it doesn't work in
mozilla / firefox, try
<a href="#" onClick="window.parent.frames['printableText'].focus();
window.parent.frames['printableText'].print();">Print the page</a>

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top