Forum Moderators: open

Message Too Old, No Replies

printable document inside javascript's iframe

         

LinuxGold

4:50 pm on Oct 27, 2003 (gmt 0)

10+ Year Member



I am designing a documentary (training, procedures, etc) web page for corporate IntraNet using JS iframes replacing frames. The only problem I am facing currently is to have browser print anything that is inside the iframes instead of the main web page. How can I configure the code to have browser print the entire contents inside JS's iframe?

Much Thanks,

Scott

DrDoc

6:35 pm on Oct 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



window.print();
// prints contents in current window

nameOfWindowOrFrame.print();
// prints contents in nameOfWindowOrFrame

LinuxGold

7:18 pm on Oct 27, 2003 (gmt 0)

10+ Year Member



Hmm, where should I put external.print(); or iframecode.print(); in this code since I'm new to javascript? My best guess is: iframecode.print(external); (not sure where to put it)Thanks for answering at first place ;)

<script type="text/javascript" language="javascript">
<!--
var displaymode=0
var iframecode='<iframe id="external" style="width:100%;height:100%;" src="Data/HotNews/HotNews.htm"><\/iframe>'
if (displaymode==0)
document.write(iframecode)

function jumpto(inputurl){
if (document.getElementById&&displaymode==0)
document.getElementById("external").src=inputurl
else if (document.all&&displaymode==0)
document.all.external.src=inputurl
else{
if (!window.win2¦¦win2.closed)
win2=window.open(inputurl)
//else if win2 already exists
else{
win2.location=inputurl
win2.focus()
}
}
}
//-->
</script>

DrDoc

9:28 pm on Oct 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can put it in a function, or even a link.

<a href="javascript:external.print()">Print</a>