我正在尝试显示打印页面的弹出窗口。 但是这个弹出窗口在Internet Explorer上显示为空白。 任何人都可以告诉我如何在IE上显示其内容。以下是我的代码 -
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<SCRIPT Language="Javascript"><!-- Begin
function printit(){
if (window.print) {
window.print() ;
} else {
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";
}}
var NS = (navigator.appName == "Netscape");
var VERSION = parseInt(navigator.appVersion);
if (VERSION > 3 )
{
document.open();
document.write('<table><tr><form><td> ');
document.write('<input type=button value=" Print this page " name="Print" onClick="printit()" class=tbflat style="cursor:hand;">');
document.write('</td></form></tr></table><br>');
document.write('<img class="logo" src="/v/vspfiles/assets/images/logo.jpg" />');
document.close();
}
// End --></script>
Please advise.