Forum Moderators: open

Message Too Old, No Replies

iframe opened in new window

open iframe-text in new window

         

RobJ

6:29 pm on Aug 28, 2007 (gmt 0)

10+ Year Member



This script prints (with a link on the page) the iframe-text thats opened in the underlying page.
<script>
function iprint(ptarget)
{
ptarget.focus();
ptarget.print();
}
</script>

<body>
<iframe name="theiframe" id="theiframe" width="500" height="200" src="some.file"></iframe>
<input type="button" value="print IFRAME" onclick="iprint(theiframe);" />
</body>

I need a script that, instead of printing, opens the iframe-text in a new window (actually a new page).

Trace

1:48 pm on Aug 29, 2007 (gmt 0)

10+ Year Member



<script type="text/javascript">
function iprint(ptarget){
window.open(document.getElementById(ptarget).src)
}
</script>

<body>
<iframe name="theiframe" id="theiframe" width="500" height="200" src="some.file"></iframe>
<input type="button" value="print IFRAME" onclick="iprint('theiframe');" />
</body>

cripplertd

5:19 pm on Aug 29, 2007 (gmt 0)

10+ Year Member



I have a simular question as that, when you do as you did Trace, it just opens the page in a new window, it's not the source?

cripplertd

5:26 pm on Aug 29, 2007 (gmt 0)

10+ Year Member



<script type="text/javascript">
function iprint(ptarget){
window.open(self.window[content-1].document.body.innerHTML)
}
</script>
<body>
<iframe name="content" id="content" width="100%" height="90%" src="some.file"></iframe>
<input type="button" value="print IFRAME" onclick="iprint('content');" />
</body>

returns
Error:'self.window[...].document.body' is null or not an object