用jquery 模拟一个对话框进行打印
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="guide.css" />
<title>用jquery对话框</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="/resources/demos/external/jquery.bgiframe-2.1.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<style>
#dialog {display:none}
</style>
<!-- 插入打印控件 -->
<OBJECT ID="jatoolsPrinter" CLASSID="CLSID:B43D3361-D075-4BE2-87FE-057188254255" codebase="jatoolsPrinter.cab#version=5,7,0,0" ></OBJECT>
<script type="text/javascript">
function doPrint(how)
{
//打印文档对象
var myDoc ={
documents: document, // 打印页面(div)们在本文档中
copyrights : '杰创软件拥有版权 [url]www.jatools.com[/url]' // 版
};
jatoolsPrinter.printPreview(myDoc ,false);
}
function goPrint()
{
$(function() {
$( "#dialog" ).dialog();
});
}
</script>
<style>
.mycls {width:400px;height:400px;border:solid 2px #0000FF;margin:3;float:left;padding:7}
</style>
</head>
<body>
<H1>
用jquery对话框
</H1>
<input type="button" value="打印">
<div class='pagecontainer'>
<div id='page1' class='mycls'>文档第一页</div>
<div id='page2' class='mycls'>文档第二页</div>
</div>
<div id="dialog" title="打印">
<p>Hello,。。。</p>
<input type="button" value="打印...">
<input type="button" value="打印">
</div>
<br>
</body>
</html> 上述代码效果:
页:
[1]