您的位置:首页 > Web前端 > JavaScript

javascript实现WEB打印(用window.open()实现).不用安装任何控件.(含代码)分享

2005-12-26 16:46 916 查看
WEB无控件打印.javascript里有一个方法竟然可以调出打印窗口,而且不用安装任何控件.
下面是用window.open()实现的。

有兴趣的朋友再加工一下,就可以实现打印指定页面的内容的了。
<head>
<script language=javascript>
function print()
{
var sHTML = '<body>哈哈哈,无控件WEB打印</body>';
var oWin = window.open('', 'printwindow', 'menubar=no,location=no,resizable=yes,scrollbars=no,status=no,width=400,height=300');

if(oWin) {
oWin.document.open();
oWin.document.write(sHTML);
oWin.document.close();
oWin.print();
oWin.close();
}
else {
}
}
</script>

</head>
<span onclick="print()">Click Here To Print</span>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: