<object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
</object>
<OBJECT id=closes type=application/x-oleobject
classid=clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11><param name=Command value=Close></object>
<SCRIPT>
function window.onbeforeprint(){
alert("打印前事件");
}
function window.onafterprint(){
alert("打印后事件");
closes.Click();
}
</SCRIPT>
<input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置>
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,6) type=button value=打印预览>
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=页面打印>
</object>
<OBJECT id=closes type=application/x-oleobject
classid=clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11><param name=Command value=Close></object>
<SCRIPT>
function window.onbeforeprint(){
alert("打印前事件");
}
function window.onafterprint(){
alert("打印后事件");
closes.Click();
}
</SCRIPT>
<input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置>
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,6) type=button value=打印预览>
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=页面打印>
解决方案 »
- 请教基础的树状目录折叠问题
- IE7 跳转页面问题有报酬
- 求一段代码
- 保存网页标注效果
- 如何使用代码控制将一段文字拷贝到一个html编辑器中?
- 如何用JavaScript调用"ActiveX控件的方法"?
- 现在叉掉IE事件可以用onunload解决 可是别的异常退出呢?■■■最后10分■■■
- 请教各位:显示第二行语法错误,为什么?
- jsp怎么拿单选按钮的值填充到当前页面上
- 地图能按华东地区、华北地区、华南地区、华中地区、西南地区、东北地区划分成这几大区域吗,想统计各个区域下的数据,当鼠标点击一个区域时,该区域高亮显示,并谈出该区域
- 我这样写为什么错了?
- WIN2003下RegExp对象的exec()方法的执行效率问题
<!-- IE5.5以上 -->
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>
<input type=button value=打印 onclick="document.all.WebBrowser.ExecWB(6,1)">
<input type=button value=直接打印 onclick="document.all.WebBrowser.ExecWB(6,6)">
<input type=button value=页面设置 onclick="document.all.WebBrowser.ExecWB(8,1)">
<input type=button value=打印预览 onclick="document.all.WebBrowser.ExecWB(7,1)">
哪位大哥帮帮我吧!
framename指的是iframe的ID
用这个:
<script>
document.frames("ifrm").document.execCommand("Print", false);//"ifrm"为iframe的ID
</script>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>
<input type=button value=页面设置 onclick="document.frames("ifrm").document.WebBrowser.ExecWB(8,1)">
<input type=button value=打印预览 onclick="document.frames("ifrm").document.WebBrowser.ExecWB(7,1)">
----------------------
var strObject="<OBJECT ID=\"pt\" CLASSID=\"CLSID:B43D3361-D975-4BE2-87FE-438AB8E74394\" codebase=\"brochuremachine.cab\" VIEWASTEXT></OBJECT>";
//var ptc=document.createElement(strObject);
var printerCTL=oDoc.getElementById("pt");
try {
if ( ! printerCTL){
oDoc.body.insertAdjacentHTML("beforeEnd",strObject);
}
var printerCTL=oDoc.all.pt;
printerCTL.SetFilePath("http://blueswing.vicp.net/PrintTemplate/xp/pt.htm");
printerCTL.LaunchPT();
}
catch(e){
alert("打印预览过程中出现错误");
}oDoc就是iframe的document对象,你可以通过对于iframe页面动态插入控件,然后调用其方法来实现的
我用了你的方法,其中的打印预览无法实现,报错为:未知错误!<input type=button value=打印预览 onclick="document.all.WebBrowser.ExecWB(7,1)">
怎样对iframe页面动态插入控件?
我的iframe的ID为ifrm1,用ifrm1.body.insertAdjacentHTML("beforeEnd",strObject);提示ifrm1.body为空或不是对象.
<input type=button value="横向打印">
<input type=button value="纵向打印">
不用提示用户再次设置,直接按照按钮提示打印