Printing other Frames

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • GodFoca

    Printing other Frames

    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="pritableT ext">
    <frame src="..." name="printButt on" scrolling="NO" noresize>
    </frameset>

    And, in printButton, I got this code:

    <a href="#" onClick="parent .printableText. focus();
    parent.printabl eText.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


  • kaeli

    #2
    Re: Printing other Frames

    In article <ca20dc$lf7$1@d avinci.fing.edu .uy>,
    n.sanguinetti@a dinet.com.uy enlightened us with...[color=blue]
    > Hey all! I have a frameset with two frames, and want to have a button in one
    > frame call print() in the other one:
    >[/color]
    <snip>[color=blue]
    >
    > Does anyone have a clue onto what's happening?
    >[/color]

    Well, unless you typed wrong, you have a typo in your frameset.[color=blue]
    > <frame src="..." name="pritableT ext">[/color]
    should be
    name="printable Text"
    (missing 'n')

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

    Try this instead
    <a href="#" onClick="window .parent.printab leText.focus();
    window.parent.p rintableText.pr int();">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.f rames['printableText'].print();">Prin t the page</a>

    --
    --
    ~kaeli~
    A chicken crossing the road is poultry in motion.



    Comment

    Working...