javascript.window.print 参数中文什么意思

var hkey_root,hkey_path,hkey_
hkey_root=&HKEY_CURRENT_USER&;
hkey_path=&\\Software\\Microsoft\\Internet Explorer\\PageSetup\\&;
//网页打印时清空页眉页脚
function pagesetup_null() {
var RegWsh = new ActiveXObject(&WScript.Shell&)
hkey_key = &header&
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, &&)
hkey_key = &footer&
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, &&)
} catch (e) {}
function pagesetup_default() {
var RegWsh = new ActiveXObject(&WScript.Shell&)
hkey_key = &header&
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, &&w&b页码,&p/&P&)
hkey_key = &footer&
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, &&u&b&d&)
} catch (e) {
function doPrint(printDiv) {
pagesetup_null();
newwin = window.open(&&, &newwin&, &height=& + window.screen.height + &,width=& + window.screen.width + &,toolbar=no,scrollbars=auto,menubar=no&);
newwin.document.body.innerHTML = document.getElementById(printDiv).innerHTML;
newwin.window.print();
newwin.window.close();
pagesetup_default();
}catch(e){}
昵称: chuanzhang5687 &时间:
昵称: net_lover &时间:
昵称: net_lover &时间:(责任编辑:)
友情链接:联系人:QQjavascript:window.print()&打印【转载】
1.JavaScript打印
&input id="btnPrint" type="button" value="button"
onclick="javascript:window.print();" style="color:#00f;
font-weight: text-decoration:cursor:pointer!
cursor:hand"/&
可以用样式控制,你想让那块打印就打印,样式如下:
&style type="text/css"
media=print&
.noprint{display : none }
然后使用样式就可以:
class="noprint"&不需要打印的地方&/p&
如果要打印网页中的某一部分,只要把这一部分标记为&
&!--startprint--&&!---endprint--&中就可以了&
=============================================================
&script language="javascript"&
打印页面设置
function printsetup() { wb.execwb(8,1);}&
// 打印页面预览
function printpreview() { wb.execwb(7,1); }
function printit(){ if (confirm('确定打印吗?')) { wb.execwb(6,6)
classid="CLSID:A_11D0_A96B_00C04FD705A2"&
&link rel=alternate
media=print&&&
href="printversion.doc"&&&&
height=0 id=wb name=wb
width=0&&/OBJECT&
&input type=button name=button_print
value="打印"&&&&&&&
onclick="javascript:printit()"&
&input type=button name=button_setup
value="打印页面设置"&&&&&&&&
onclick="javascript:printsetup();"&
&input type=button name=button_show value="打印预览"
onclick="javascript:printpreview();"&
&input type=button name=button_fh
value="关闭"&&&&&&
onclick="javascript:window.close();"&
------------------------------------------------
关于这个组件还有其他的用法,列举如下:
WebBrowser.ExecWB(1,1) 打开
Web.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口
Web.ExecWB(4,1) 保存网页
Web.ExecWB(6,1) 打印
Web.ExecWB(7,1) 打印预览
Web.ExecWB(8,1) 打印页面设置
Web.ExecWB(10,1) 查看页面属性
Web.ExecWB(15,1) 好像是撤销,有待确认
Web.ExecWB(17,1) 全选
Web.ExecWB(22,1) 刷新
Web.ExecWB(45,1) 关闭窗体无提示
&%@&Page&Language="C#"&&CodeFile="Default.aspx.cs"&Inherits="Dept_Default"&%&
&!DOCTYPE&html&PUBLIC&"-//W3C//DTD
Transitional//EN"&"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&
&html&xmlns="http://www.w3.org/1999/xhtml"&
&head&runat="server"&
&&&&&title&&/title&&&&
&&&&&script&type="text/javascript"&
&&&&function&printpage()
document.getElementByIdx_x("noprint").style.display="none";//打印整个页面包括标题,在调用打印方法之前隐藏不需要打印的页面标签。无标题将不打印标题
&&&&function&printsetup()
&&&&&&&&try
&&&&&&&&&&&
document.all.WebBrowser.ExecWB(8, 1);
&&&&&&&&catch(e)
&&&&&&&&&&&&//ymPrompt.errorInfo({title:SYS_NAME,
message:'页面设置需要ActiveX, 请允许本站点使用ActiveX'});
printpage();
&&&&&/script&
&&&&&object&id="WebBrowser"&classid="CLSID:A-11D0-A96B-00C04FD705A2"&height="0"
&&&&&&&&width="0"&viewastext&
&&&&&/object&
&&&&&form&id="form1"&runat="server"&
&&&&&&&font&color="red"&打
印&br&/&点点滴滴&/font&&dfdsfdsfds
&&&&&&&&&input&type="button"&value="打
印"&id="noprint"&class="btnnm"&onmouseover="this.className='btnon'"
&&&&&&&&&&&&onmouseout="this.className='btnnm'"&onclick="printsetup();"&/&
&&&&&/div&
&&&&&/form&
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。}

我要回帖

更多关于 javascript out.print 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信