使用JavaScript打印网页指定DIV区域】的更多相关文章

JavaScript打印函数myPrint(obj): JavaScript打印页面指定div区域原理:使用window.open()在浏览器打开一个新的页面(window), 使用 window.document.write()将指定div区域的内容写入新窗口文档,document.close()关闭文档,使用window.print()调用打印机打印当前文档. function myPrint(obj){ //打开一个新窗口newWindow var newWindow=window.ope…
原文:在ASP.NET2.0里打印网页指定的内容(比如打印网页里的一个Table) 打印指定内容: <html> <head> <script   type= "text/javascript "   language= "javascript "> function   printPage()   {   var   newWin   =   window.open( 'about:blank ', ' ', ' ');   v…
本文转载原地址:这里 document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.documentElement.clientWidth ==> 可见区域宽度 document.documentElement.clientHeight ==> 可见区域高度 网页可见区域宽: document.body.clientWidth 网页可见区域高: document.bod…
本文转载原地址:这里 document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.documentElement.clientWidth ==> 可见区域宽度 document.documentElement.clientHeight ==> 可见区域高度 网页可见区域宽: document.body.clientWidth 网页可见区域高: document.bod…
项目中,需要对页面的部分div进行打印,为了保证界面布局不乱,采取了新建iframe的方法. 将需要打印的div放到iframe中,然后调用iframe进行打印,就可以很好的实现局部打印的效果了. 同时兼容性还很好,以下是我实现的代码,前端小鸟,大神有指点的,请留言赐教哈,提前感谢! <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <t…
function doPrint() { setTimeout(function() { bdhtml=window.document.body.innerHTML; sprnstr="<!--startprint-->"; eprnstr="<!--endprint-->"; prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); prnhtml=prnhtml.substring(0,prnh…
$(document).on("click", ".navbar-nav li[link]", function() { nav.find('li').removeClass('active'); $(this).addClass('active'); //获取模块到顶部的距离 var id = $(this).attr("link") //获取顶部导航条高度 var topH = $("#top-nav").height()…
用window.print()打印指定div里面的内容 今天客户让添加个打印证照功能,直接用window.print()打印的是整个页面,而用以下方法就可以只打印证明了 <!--window.print打印指定div window.print可以打印网页,但有时候我们只希望打印特定控件或内容,怎么办呢? 首先我们可以把要打印的内容放在div中,然后用下面的代码进行打印. --> <html> <head> <script language="javasc…
用window.print()打印指定div里面的内容 今天客户让添加个打印证照功能,直接用window.print()打印的是整个页面,而用以下方法就可以只打印证明了 <!--window.print打印指定div window.print可以打印网页,但有时候我们只希望打印特定控件或内容,怎么办呢? 首先我们可以把要打印的内容放在div中,然后用下面的代码进行打印. --> <html> <head> <script language="javasc…
window.print可以打印网页,但有时候我们只希望打印特定控件或内容,怎么办呢? 首先我们可以把要打印的内容放在div中,然后用下面的代码进行打印. <html> <head> <script language="javascript"> function printdiv(printpage) {      var headstr = "<html><head><title></title&…