window.print()
来源:互联网 发布:淘宝正品小样店推荐 编辑:程序博客网 时间:2024/05/27 08:13
function printTemplete(contractNum,path) {
var headstr = "<html><head><title>"+contractNum+"</title>" +
"<link href=\""+path+"/favicon.ico\" rel=\"shortcut icon\" />"+
"<link href=\""+path+"/styles/kendo.common.minnew.css\" rel=\"stylesheet\">"+
"<link href=\""+path+"/styles/kendo.blueopal.min.css\" rel=\"stylesheet\">"+
"<link href=\""+path+"/css/common.css\" rel=\"stylesheet\">"+
"<link href=\""+path+"/css/itemmemo.css\" rel=\"stylesheet\">"+
"<link href=\""+path+"/css/ui.css\" rel=\"stylesheet\">"+
"<style type=\"text/css\">"+
"br.pageEnd {page-break-after:always}"+
"input{border:2px solid blue;background-color:transparent;}"+
"textarea{border:2px solid blue;background-color:transparent;}"+
"</style>"+
"</head><body>";
var footstr = "</body>";
var bdhtml = window.document.body.innerHTML;// 获取当前页的html代码
var sprnstr = "<!--startprint1-->";// 设置打印开始区域
var eprnstr = "<!--endprint1-->";// 设置打印结束区域
var prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr)); // 从开始代码向后取html
prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));// 从结束代码向前取html
//打开一个新窗口newWindow
var newWindow=window.open("打印窗口","_blank");
//要打印的div的内容
//var docStr = obj.innerHTML;
//打印内容写入newWindow文档
newWindow.document.write(headstr+prnhtml+footstr);
//关闭文档
newWindow.document.close();
//调用打印机
newWindow.print();
//关闭newWindow页面
newWindow.close();
}
var headstr = "<html><head><title>"+contractNum+"</title>" +
"<link href=\""+path+"/favicon.ico\" rel=\"shortcut icon\" />"+
"<link href=\""+path+"/styles/kendo.common.minnew.css\" rel=\"stylesheet\">"+
"<link href=\""+path+"/styles/kendo.blueopal.min.css\" rel=\"stylesheet\">"+
"<link href=\""+path+"/css/common.css\" rel=\"stylesheet\">"+
"<link href=\""+path+"/css/itemmemo.css\" rel=\"stylesheet\">"+
"<link href=\""+path+"/css/ui.css\" rel=\"stylesheet\">"+
"<style type=\"text/css\">"+
"br.pageEnd {page-break-after:always}"+
"input{border:2px solid blue;background-color:transparent;}"+
"textarea{border:2px solid blue;background-color:transparent;}"+
"</style>"+
"</head><body>";
var footstr = "</body>";
var bdhtml = window.document.body.innerHTML;// 获取当前页的html代码
var sprnstr = "<!--startprint1-->";// 设置打印开始区域
var eprnstr = "<!--endprint1-->";// 设置打印结束区域
var prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr)); // 从开始代码向后取html
prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));// 从结束代码向前取html
//打开一个新窗口newWindow
var newWindow=window.open("打印窗口","_blank");
//要打印的div的内容
//var docStr = obj.innerHTML;
//打印内容写入newWindow文档
newWindow.document.write(headstr+prnhtml+footstr);
//关闭文档
newWindow.document.close();
//调用打印机
newWindow.print();
//关闭newWindow页面
newWindow.close();
}
阅读全文
0 0
- window.print()
- Window.print
- window.print()
- window.print()
- window.print()使用
- CSS for window.print()
- window print 设置字体大小
- window.print()的使用
- window.print打印网页
- window.print的应用
- window.print 页面打印
- window.print分页打印
- 22. Window print() 方法
- web打印 window.print()
- window.print()打印功能
- web打印window.print
- window.print 页面打印
- window.print 页面打印
- python3.5学习if笔记(1)
- windows下Python读取中文目录
- HDU 2089 不要62【数位dp】【模板题】
- No mapping found for HTTP request with URI...
- mysql常见面试题
- window.print()
- 数据结构——查找(2)
- shell研究(1)-简介
- 进入docker(2)
- 触摸屏-原理及流程回顾
- ubuntu中man显示中文
- 【Ubuntu】使用Archive Manager解压RAR显示Parsing filters is unsupported.
- viewpager 无限轮播
- openpose vs2015 cuda8.0 cudnn5.0 TiTan xp 环境配置