Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print frame from print button in another frame

Status
Not open for further replies.

hibbardbob

Programmer
Oct 18, 2000
1
US
I'm trying to print a frame using a print button that exists in another frame. I can get it to work in Netscape, but not IE 5.5. Here's the JavaScript/HTML code I am using:

FRAMEPRINT
<HTML>
<HEAD><TITLE>Testing frame print</TITLE>
</HEAD>
<FRAMESET ROWS=&quot;33%,33%,33%&quot;>
<FRAME SRC=&quot;/OrderStat/header.html&quot; NAME=&quot;print_header&quot;>
<FRAME SRC=&quot; NAME=&quot;print_body&quot;>
<FRAME SRC=&quot;file:///C|/Hibbard/Zips/print_frame.html&quot; NAME=&quot;print_footer&quot;>
</FRAMESET>
</HTML>

PRINTFRAME
<html>
<body>
<OBJECT ID=WBCONTROL WIDTH=0 HEIGHT=0
CLASSID=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></OBJECT>
<SCRIPT LANGUAGE=&quot;VBSCRIPT&quot;><!-- //
Sub VBPrint() On Error Resume Next
WBControl.ExecWB 6,1
End Sub
// --></SCRIPT>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;><!-- //
if (navigator.appName.indexOf('Microsoft') !=-1)
// document.write('<FORM><INPUT TYPE=&quot;BUTTON&quot; ONCLICK=&quot;VBPrint()&quot; VALUE=&quot;Print this IE!&quot;></FORM>');
document.write('<a href=&quot;#&quot; onclick=&quot;window.top.print_body.focus(); window.top.print_body.print();&quot; target=&quot;print_body&quot;>Print this IE!');
else if (self.print)
document.write('<FORM><INPUT TYPE=&quot;BUTTON&quot; ONCLICK=&quot;printotherframe()&quot; value=&quot;Print this Netscape!&quot;>'</FORM>);
// --></SCRIPT>
<Script Language=&quot;JavaScript&quot;>
function printotherframe() {
parent.print_body.focus();
parent.print_body.print();
}
</script>
</body>
</html>

As you can see, I've tried a few different ways (commented out code) and have been unsuccessful. I have even been able to get it to respond using IE, but have not been able to print out the right frame.

[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top