js打印

<script>
//-----  下面是打印控制语句  ----------
//window.οnbefοreprint=beforePrint;
//window.οnafterprint=afterPrint;

beforePrint();
window.print();
afterPrint();

//打印之前隐藏不想打印出来的信息
function beforePrint()
{
     span2.style.display='none';
}
//打印之后将隐藏掉的信息再显示出来
function afterPrint()
{
    span2.style.display='';
}
</script>
资料来源:学网(www.xue5.com),原文地址:http://www.xue5.com/itedu/200802/103433.html

 

 

 

function saveas()
{
       var fd = new ActiveXObject("MSComDlg.CommonDialog");
        fd.Filter = "Microsoft Office Excel(*.xls)|*.xls";
        fd.FilterIndex = 2;

        // 必须设置MaxFileSize. 否则出错
        fd.MaxFileSize = 128;
        // 显示对话框
        fd.ShowSave();
}

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

<object id="WebBrowser" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
</object>
【<a href="#" οnclick="javascript:WebBrowser.ExecWB(4,1)">另存为</a>】
【<a href="#" οnclick="javascript:document.execCommand('saveAs')">另存为HTML文档</a>】
【<a href="#" οnclick="javascript:window.print()">打印文章</a>】
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


■打开■
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开>
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■另存为■
<input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■属性■
<input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■打印■
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
 打印机预览:document.all.WebBrowser.ExecWB(7,1);
■页面设置■
<input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■刷新■
<input type=button value=刷新 name=refresh >
■导入收藏■
<input type="button" name="Button" value="导入收藏夹" onClick=window.external.ImportExportFavorites(true,);>
■导出收藏■
<input type="button" name="Button3" value="导出收藏夹" onClick=window.external.ImportExportFavorites(false,);>
■加入收藏■
<INPUT name=Button2 type=button value=加入收藏夹>
■整理收藏夹■
<INPUT name=Submit2 type=button value=整理收藏夹>
■查看原文件■
<INPUT name=Button οnclick=window.location = "view-source:" + window.location.href type=button value=查看源文件>
■语言设置■
<INPUT name=Button type=button value=语言设置>
■前进■
<INPUT name=Submit οnclick=history.go(1) type=submit value=前进>
■后退■
<INPUT name=Submit2 οnclick=history.go(-1) type=submit value=后退>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值