<html>
<head>
<title>頁面設(shè)置</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<script language="javascript">
var HKEY_Root,HKEY_Path,HKEY_Key;
var HKEY_Root = "HKEY_CURRENT_USER";
var HKEY_Path = " Explorer\\PageSetup\\";
var HKEY_BASE = HKEY_Root + HKEY_Path;
var Wsh = new ActiveXObject("WScript.Shell");
function checkSubmit(){
}
//因為要調(diào)用組件來改寫注冊表,所改要把IE安全度調(diào)低一點
//Internet選項-安全-自定義級別
//特別ActiveX控件和插件那一欄,把禁用的改為提示
//初始化頁面數(shù)據(jù)
function initData(){
try{
//document.getElementById"header").value = Wsh.RegRead(HKEY_BASE + "header"); //頁眉
//document.getElementById"footer").value = Wsh.RegRead(HKEY_BASE + "footer"); //頁腳
document.getElementById"margin_top").value = Wsh.RegRead(HKEY_BASE + "margin_top"); //上邊距
document.getElementById"margin_bottom").value = Wsh.RegRead(HKEY_BASE + "margin_bottom"); //下邊距
document.getElementById"margin_left").value = Wsh.RegRead(HKEY_BASE + "margin_left"); //左邊距
document.getElementById"margin_right").value = Wsh.RegRead(HKEY_BASE + "margin_right"); //右邊距
}catch(e){
alert('不能進(jìn)行頁面設(shè)置,請降低IE安全級別!\nInternet選項-安全-自定義級別\n[ActiveX控件和插件]一欄,把所有(禁用)的改為(提示)');
}
}
//保存數(shù)據(jù)
function saveData(){
try{
Wsh.RegWrite(HKEY_BASE + "header","");
Wsh.RegWrite(HKEY_BASE + "footer","");
Wsh.RegWrite(HKEY_BASE + "margin_top","<%=Request("margin_top")%>"); //上邊距
Wsh.RegWrite(HKEY_BASE + "margin_bottom","<%=Request("margin_bottom")%>"); //下邊距
Wsh.RegWrite(HKEY_BASE + "margin_left","<%=Request("margin_left")%>"); //左邊距
Wsh.RegWrite(HKEY_BASE + "margin_right","<%=Request("margin_right")%>"); //右邊距
initData();
alert('設(shè)置成功!');
self.close();
}
catch(e){
alert(e + "\n設(shè)置失敗!");
}
}
//頁面加載事件
function pageLoad(){
if(sy_QueryString("action") == "SAVE"){
saveData();
return;
}
initData();
}
</script>
</head>
<body onload="pageLoad()">
<form name="form1" method="post" action="PageSetup.asp?action=SAVE" onSubmit="return checkSubmit()" >
<table valign="center" align="center" width="95%" border="1" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#4a65a5">
<tr>
<td bgcolor="#4a65a5"><font color="#FFFFFF">頁邊距:</font></td>
</tr>
<tr>
<td height="139">
<table width="100%" border="0" cellspacing="10" cellpadding="0" align="center" height="100%">
<tr>
<td height="99">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="1" bgcolor="#336699"></td>
<td height="1" bgcolor="#336699"></td>
</tr>
<tr>
<td bgcolor="#f5f5f5" height="3"> </td>
<td bgcolor="#f5f5f5" height="3"> </td>
</tr>
<tr>
<td bgcolor="#f5f5f5" height="2">上:</td>
<td bgcolor="#f5f5f5">
<input type="text" id="margin_top" name="margin_top" size="20" value=""></td>
</tr>
<tr>
<td bgcolor="#f5f5f5" height="2">下:</td>
<td bgcolor="#f5f5f5">
<input type="text" id="margin_bottom" name="margin_bottom" size="20" value=""></td>
</tr>
<tr>
<td bgcolor="#f5f5f5" height="2">左:</td>
<td bgcolor="#f5f5f5">
<input type="text" id="margin_left" name="margin_left" size="20" value=""></td>
</tr>
<tr>
<td bgcolor="#f5f5f5" height="2">右:</td>
<td bgcolor="#f5f5f5">
<input type="text" id="margin_right" name="margin_right" size="20" value=""></td>
</tr>
<tr align="right">
<td height="80" bgcolor="#f5f5f5" colspan="2" align="center">
<input type="submit" name="subOk" value=" 提 交 " class="stbtm" style="margin-right:8px">
<input type="button" name="Submit3" value=" 取 消 " class="stbtm" onClick="javascript:self.close();">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr align="right">
<td bgcolor="#336699" height="3">
</td>
</tr>
</table>
</form>
</body>
</html>
更多信息請查看IT技術(shù)專欄