JavaScript 打印Div内容】的更多相关文章

<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 divEleme…
jquery: 例如<div id="abc"><a>内容</a></div>$("#abc").html(); //获取匹配选择器内容==结果:<a>内容</a>$("#abc").text(); //获取匹配选择器文本(不包含嵌入的HTML标签)结果:内容…
JavaScript打印函数myPrint(obj): JavaScript打印页面指定div区域原理:使用window.open()在浏览器打开一个新的页面(window), 使用 window.document.write()将指定div区域的内容写入新窗口文档,document.close()关闭文档,使用window.print()调用打印机打印当前文档. function myPrint(obj){ //打开一个新窗口newWindow var newWindow=window.ope…
1.程序说明 1) 此程序可以实现选择页面中的区域进行打印,以iframe方式进行打印: 2) 与原生态的print() 区别在于,取消打印页面后可以完整保留当前访问页面的内容. 2.代码部分 1) JS 函数:  代码如下 复制代码 function do_print(id_str)//id-str 打印区域的id{      var el = document.getElementById(id_str);      var iframe = document.createElement('…
有时候网页用到打印但是不想打印所有内容,就需要只打印指定内容,下面简单演示下如何打印指定内容 1.在需要打印的指定内容的头部前面加“<!--startprint-->”,在尾部后面加上“<!--endprint-->” <!--startprint--> <div> 需要打印的内容 </div> <!--endprint--> 2.添加JS代码 <script language=javascript> function d…
jquery鼠标移动div内容上下左右滚动 点击这里查看效果:http://keleyi.com/keleyi/phtml/jqtexiao/9.htm <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://ww…
做了一个作业,用JavaScript打印正倒直线,突然觉得自己还是逻辑有待加强训练啊 document.write("<h3>打印倒正金字塔直线</h3>");//打印一个h3标签,内容是里边的文字 var i= 61;//定义金字塔的起始/截止宽度(百分比为单位) while(i>0)//进行循环,当宽度大于0时,打印一个宽度为i的hr水平线,并将i自减10个百分比 { document.write("<hr width=" +…
demo1: <!DOCTYPE html> <html> <head> <title>div内容间隔1秒动态滚动</title> </head> <body> <div id="demo"> <span id="sp"> <p>恭喜133****1231用户获得100元手机话费</p> <p>恭喜134****1232用户…
javascript dom追加内容的使用还是比较广泛的,在本文将为大家介绍下具体的使用方法. 例子: <!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"…
Ajax刷新DIV内容 实现了网页的异步数据处理,不用刷新整个页面 <标签 onmouseover="method"/ >method:这个参数是处理onmouseover事件的方法.<li onmouseover="startRequest('1')">简单</li><li onmouseover="startRequest('2')">面向对象</li><li onmouseo…