function DP() // mainFrame網頁中函數
{
window.focus();
if (window.print) {
window.status='none';
// window.print();
doPrint();
}
}
function doPrint() {
/// 隱藏不需要打印的內容
try
{
PageSetup_Null();
}
catch(e)
{
var errorMsg = e.message+"/r"+"請設置:IE選項->安全->Internet->"+"ActiveX控件和插件"+"/r"+"對未標記爲可安全執行腳本的ActiveX的控件初始化並執行腳本->允許/提示";
alert(errorMsg);
return;
}
window.print();
}
//設置網頁打印的頁眉頁腳爲空
function PageSetup_Null()
{
var HKEY_Root,HKEY_Path,HKEY_Key;
HKEY_Root="HKEY_CURRENT_USER";
HKEY_Path="//Software//Microsoft//Internet Explorer//PageSetup//";
var Wsh=new ActiveXObject("WScript.Shell");
HKEY_Key="header";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
HKEY_Key="footer";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
HKEY_Key="margin_left"
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"0.50000"); //鍵值設定--左邊邊界
HKEY_Key="margin_top"
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"0.50000"); //鍵值設定--上邊邊界
HKEY_Key="margin_right"
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"0.50000"); //鍵值設定--右邊邊界
HKEY_Key="margin_bottom"
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"0.50000"); //鍵值設定--下邊邊界
}