明辉站/网站教程/内容

把以下代码加在页面里

网站教程2024-01-13 阅读
[摘要]<script language="Javascript">function printit() if (NS) window.print() ; else var WebBrowser = '<OBJECT ID="W...

<script language="Javascript">
function printit(){  
if (NS) {
    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 = "";  
}
}
</script>

<script language="Javascript">  
var NS = (navigator.appName == "Netscape");
var VERSION = parseInt(navigator.appVersion);
if (VERSION > 3) {
    document.write('<form><input class="unnamed" type=button value="请按此打印本页" name="Print" onClick="printit()"></form>');        
}
</script>

……

相关阅读