您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

js print打印网页指定区域内容的简单实例

2026/2/4 7:10:13发布16次查看
实例如下:
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>js print打印网页指定区域内容的简单实例</title> </head> <script> function myprint(obj){ var newwindow=window.open("打印窗口","_blank"); var docstr = obj.innerhtml; newwindow.document.write(docstr); newwindow.document.close(); newwindow.print(); newwindow.close(); } </script> <div id="print"> <hr /> 打印演示区域,点击打印后会在新窗口加载这里的内容! <hr /> </div> <button onclick="myprint(document.getelementbyid('print'))">打 印</button> </html>
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product