window.print实现打印特定控件或内容
window.print打印指定div
首先我们可以把要打印的内容放在div中,然后用下面的代码进行打印。
<html>
<head>
<script language="javascript">
function printdiv(printpage)
{
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr+newstr+footstr;
window.print();
document.body.innerHTML = oldstr;
return false;
}
</script>
<title>div print</title>
</head> <body>
//HTML Page
//Other content you wouldn't like to print
<input name="b_print" type="button" class="ipt" onClick="printdiv('div_print');" value=" Print "> <div id="div_print"> <h1 style="Color:Red">The Div content which you want to print</h1> </div>
//Other content you wouldn't like to print
//Other content you wouldn't like to print
</body>
</html>
window.print实现打印特定控件或内容的更多相关文章
- HOW TO:使用 Visual C# .NET 打印 RichTextBox 控件的内容
概要 本分步指南介绍了如何打印 RichTextBox 控件的内容.RichTextBox 控件没有提供任何打印 RichTextBox 内容的方法.您可以扩展 RichTextBox 类以使用 EM ...
- C#如何打印RichTextBox控件的内容
本任务的内容 摘要 创建 RichTextBoxPrintCtrl 控件 测试控件 参考 概要 本分步指南介绍了如何打印 RichTextBox 控件的内容.RichTextBox 控件没有提供任 ...
- 读取其他软件listview控件的内容
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- C++ 一个程序获取另一个程序Edit控件的内容
//一个程序获取另一个程序Edit控件的内容 //根据指定程序的标题名获取改程序窗口的句柄 HWND hWnd=::FindWindow(NULL,"zhang001"); if( ...
- 重新想象 Windows 8 Store Apps (3) - 控件之内容控件: ToolTip, Frame, AppBar, ContentControl, ContentPresenter; 容器控件: Border, Viewbox, Popup
原文:重新想象 Windows 8 Store Apps (3) - 控件之内容控件: ToolTip, Frame, AppBar, ContentControl, ContentPresenter ...
- C#获取类名为Internet_Explorer_Server控件的内容
为了让大家都能够使用demo,我以IE为测试对象,另外为了突出重点,所以如何获取窗口句柄我就不做演示了(不清楚的童鞋,可以去Google下哈),句柄值我使用spy++获得 大家可以下载demo(附:s ...
- ListView 控件与 内容
1)由控件获取内容:ListViewItem item = Utilities.GetVisualParent<ListViewItem>(chx); if (item == null) ...
- js打印(控件)及多种方式
非常好用的LODOP打印控件 Lodop打印控件简单使用方法 1.安装. 2.调用LodopFuncs.js文件. 3.增加OBJECT对象 <script language="jav ...
- JS打印——第三方控件打印
LODOP 官方地址:http://www.lodop.net/ 一个很好的打印控件,可以是实现纸张设置.横打竖打.打印预览.打印维护多种功能.官网的示例非常详细.能很好支持多种浏览器的打印. 在使用 ...
随机推荐
- C++@命名空间(转)
转自http://hi.baidu.com/rainysky_2006/blog/item/a490e01fc3de7964f724e4d1.html 本讲基本要求 * 掌握:命名空间的作用及定义:如 ...
- java多线程之:创建开启一个线程的开销
---->关于时间,创建线程使用是直接向系统申请资源的,这里调用系统函数进行分配资源的话耗时不好说.---->关于资源,Java线程的线程栈所占用的内存是在Java堆外的,所以是不受jav ...
- Fortran编译多个文件(转载)
最近需要在Linux系统下编译多个Fortran程序,在网上搜索了一下,但是资料不多,也许因为这个问题比较简单,不值一提,但还是把我知道的写出来,供大家参考: 方法一: 假如现在有两个Fortran程 ...
- Applied Deep Learning Resources
Applied Deep Learning Resources A collection of research articles, blog posts, slides and code snipp ...
- Checking the content of the pointer
https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/d481b7ec-cd67-476c-b2d7-ca3334effa16/h ...
- 关于ftp操作内容记录
ftp问题解决: http://www.linuxdiyf.com/viewarticle.php?id=272088 IPTABLES_MODULES="ip_nat_ftp ip_con ...
- HTTP 错误 500.19 - Internal Server Error 无法访问请求的页面,因为该页的相关配置数据无效。
HTTP 错误 500.19 - Internal Server Error 无法访问请求的页面,因为该页的相关配置数据无效. 详细错误信息模块 IIS Web Core 通知 BeginReques ...
- html初学(二)
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <table bor ...
- maven Spring 4.2+SpringMVC+dubbo解决TypeProxyInvocationHandler.invoke(SerializableTypeWrapper.java:239)
java.lang.NullPointerException org.springframework.core.SerializableTypeWrapper$TypeProxyInvocationH ...
- 对自己的文件使用keystore签名
keytool 对jar包签名步骤: 1.将程序打成jar包. 2.生成keystore数字证书keytool -genkey -keystore xxx.keystore -alias xxx -v ...