hibbardbob
Programmer
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="33%,33%,33%">
<FRAME SRC="/OrderStat/header.html" NAME="print_header">
<FRAME SRC=" NAME="print_body">
<FRAME SRC="file:///C|/Hibbard/Zips/print_frame.html" NAME="print_footer">
</FRAMESET>
</HTML>
PRINTFRAME
<html>
<body>
<OBJECT ID=WBCONTROL WIDTH=0 HEIGHT=0
CLASSID=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></OBJECT>
<SCRIPT LANGUAGE="VBSCRIPT"><!-- //
Sub VBPrint() On Error Resume Next
WBControl.ExecWB 6,1
End Sub
// --></SCRIPT>
<SCRIPT LANGUAGE="JavaScript"><!-- //
if (navigator.appName.indexOf('Microsoft') !=-1)
// document.write('<FORM><INPUT TYPE="BUTTON" ONCLICK="VBPrint()" VALUE="Print this IE!"></FORM>');
document.write('<a href="#" onclick="window.top.print_body.focus(); window.top.print_body.print();" target="print_body">Print this IE!');
else if (self.print)
document.write('<FORM><INPUT TYPE="BUTTON" ONCLICK="printotherframe()" value="Print this Netscape!">'</FORM>);
// --></SCRIPT>
<Script Language="JavaScript">
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]
FRAMEPRINT
<HTML>
<HEAD><TITLE>Testing frame print</TITLE>
</HEAD>
<FRAMESET ROWS="33%,33%,33%">
<FRAME SRC="/OrderStat/header.html" NAME="print_header">
<FRAME SRC=" NAME="print_body">
<FRAME SRC="file:///C|/Hibbard/Zips/print_frame.html" NAME="print_footer">
</FRAMESET>
</HTML>
PRINTFRAME
<html>
<body>
<OBJECT ID=WBCONTROL WIDTH=0 HEIGHT=0
CLASSID=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></OBJECT>
<SCRIPT LANGUAGE="VBSCRIPT"><!-- //
Sub VBPrint() On Error Resume Next
WBControl.ExecWB 6,1
End Sub
// --></SCRIPT>
<SCRIPT LANGUAGE="JavaScript"><!-- //
if (navigator.appName.indexOf('Microsoft') !=-1)
// document.write('<FORM><INPUT TYPE="BUTTON" ONCLICK="VBPrint()" VALUE="Print this IE!"></FORM>');
document.write('<a href="#" onclick="window.top.print_body.focus(); window.top.print_body.print();" target="print_body">Print this IE!');
else if (self.print)
document.write('<FORM><INPUT TYPE="BUTTON" ONCLICK="printotherframe()" value="Print this Netscape!">'</FORM>);
// --></SCRIPT>
<Script Language="JavaScript">
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]