Using the code
On the click of a button I have called JavaScript printDiv which will print the first DIV content.
Please refer to the below code:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Page</title> <script language="javascript" type="text/javascript"> function printDiv(divID) { //Get the HTML of div var divElements = document.getElementById(divID).innerHTML; //Get the HTML of whole page var oldPage = document.body.innerHTML; //Reset the page's HTML with div's HTML only document.body.innerHTML = "<html><head><title></title></head><body>" + divElements + "</body>"; //Print Page window.print(); //Restore orignal HTML document.body.innerHTML = oldPage; } </script> </head> <body> <form id="form1" runat="server"> <div id="printablediv" style="width: 100%; background-color: Blue; height: 200px"> Print me I am in 1st Div </div> <div id="donotprintdiv" style="width: 100%; background-color: Gray; height: 200px"> I am not going to print </div> <input type="button" value="Print 1st Div" onclick="javascript:printDiv('printablediv')" /> </form> </body> </html>
相关推荐
jquery打印插件 jQuery.print.js jquery.PrintArea.js $("#print_div").print(); $("#print_div").printArea(); 局部打印需要把样式写在print_div里
window.print可以打印网页,但有时候我们只希望打印特定控件或内容,怎么办呢,请看下面的例子
条形码和二维码 生成以及打印 案例
主要介绍了window.print打印指定div指定网页指定区域的方法,需要的朋友可以参考下
python的xpath没有获取div标签内html内容的功能,也就是获取div或a标签中的innerhtml,写了个小程序实现一下: 源代码 [webadmin@centos7 csdnd4q] #162> vim /mywork/python/csdnd4q/z040.py #去掉最外层标签,...
简单的才是最实用的,使用简单的Jquery插件实现头痛的导出页面表格
bootstrap PrintThis打印效果图: 如图,这个是调用了谷歌的打印,使用很方便,可以自己調样式,需要的可以研究一下,...div class="modal fade" id="myModal_qrcode" tabindex="-1" role="dialog" aria-labelledby
代码如下: //theOb(json数据) function print_r(theObj) { var retStr = ”; if (typeof theObj == ‘object’) { retStr += ‘<div xss=removed>’; for (var p in theObj) { if (typeof theObj[p] == ‘object’...
window.print打印指定div 首先我们可以把要打印的内容放在div中,然后用下面的代码进行打印。 代码如下: <html> <head> [removed] function printdiv(printpage) { var headstr = “<html><...
vue打印功能实现的两种... //注册 3,现在就可以使用了 <div id="printTest" > 明月照于山间</p> 清风来于江上 </p> </div> <button v-print="'#printTest'">打印</button> 4.如需通过链接地址打印:window.loc
import re s = """<div>仰天大笑出门去,我辈岂是蓬蒿人</div> <div>床前明月光,疑是地上霜</div></p>""...print(r) #["<div>仰天大笑出门去,我辈岂是蓬蒿人</div></p>", # "<div>床前明月光,疑是地上霜</div></p>"]
easyui快速打印datagrid内容,通过创建<div>容纳所需要的打印内容(需要打印的表格通过方法组装成字符串放入DIV中),然后调用window.print打印;具体步骤如下:1.html页面需要有专门的DIV用于输出Dialog 2.在html...
#await page.click('#content-container > div.ebase-metaDecorator__root > div > div.ebase-FaCommonFilter__root > div > div > div > div > div.ebase-FaCommonFilter__top > div.ebase-FaCommonFilter__right ...
项目中遇到了要打印页面的功能,我感觉我这个方法不太好,欢迎各位来改善指导 使用print插件 https://github.com/xyl66/vuePlugs_printjs ... <div class=no-print>不要打印我</div> this.$print(this.$refs.
打印dom元素 ... 与 browserify 一起使用。 安装 npm install print-dom-element 例子 var print = require ( 'print-dom-element' ) ; print ( document . getElementById ( 'my-div' ) ) ; 执照 麻省理工学院
[removed][removed] ... <div id="Wealth"></div> <div id="WealthSet"></...[removed]MiniWeather.Weather.print(0,"Wealth","WealthSet");[removed] 修改weather.js中http://www.ccughc.org/bbs/(两处)为你的地址
//out.print("成功执行"+ i +"条");%> <p> 提交" /> </div> </form> </body> 五.实验数据记录 姓名:王意 性别:男 地址:湖北省广水市武胜关镇碾子湾村七组 联系电话:13647217787 Email地址;804915052@qq....
rate = each.xpath('div[@class="rating"]/span[@class="rating_nums"]/text()').extract()[0] author = re.search('<div class="abstract">(.*?), each.extract(), re.S).group(1) title = title.replace...