跟我做背景變暗,彈出提示層的功能,而且增加了對select對象的支援
其實很簡單,我也是學習别人的代碼學習來的,
注意:密碼是123
<html>
<head>
</head>
<body>
<p align="center">
<script>...
function locking()...{
document.all.ly.style.display="block";
document.all.ly.style.width=document.body.clientwidth;
document.all.ly.style.height=document.body.clientheight;
document.all.layer2.style.display='block';
}
function lock_checkform(theform)...{
if(theform.p_userpass.value=='')...{alert("錯誤:請輸入你的使用者密碼!");theform.p_userpass.focus();return false;}
if(theform.p_userpass.value !='123')...{alert("錯誤:密碼錯誤!");theform.p_userpass.value='';theform.p_userpass.focus();return false;}
else...{document.all.ly.style.display='none';document.all.layer2.style.display='none';}
return false;
</script>
</p>
<input type="button" value="系統鎖定" onclick="locking()">
<div id="ly" style="position:absolute;top:0px;filter: alpha(opacity=60);background-color:#777; z-index:2; left: 0px;display:none;"> </div>
<!-- 浮層架構開始 -->
<div id="layer2" align="center" style="position:absolute; z-index:3; width: 540; height:170px;left:expression((document.body.offsetwidth-540)/2); top: expression((document.body.offsetheight-170)/2);background-color:#fff;display:none;" valign="center">
<form method="post" action="" onsubmit="return lock_checkform(this);">
<table width=540 height=170 border=0 cellpadding=0 cellspacing=0 style="border:0 solid #e7e3e7;border-collapse: collapse">
<tr>
<td style="background-color:#73a2d6;color:#fff;padding-left:4px;padding-top:2px;font-weight:bold;font-size:14px;" height=27 valign="center">[&nbsp;警&nbsp;告&nbsp;]</td>
</tr>
<td align="center" valign="center">請輸入解除鎖定密碼<p><input type="text" name="p_userpass" size="20"></td>
<td height=30 align="center"><input type="submit" value=" 确 定 "></td>
</table>
</form>
</div>
<!-- 浮層架構結束 -->
</body>
</html>
插入一個代碼吧,友善你們用;)沒辦法,不能上傳檔案,還是貼代碼吧;(
方法二 popup的方式
<script language="javascript">...
<!--
var opopup=window.createpopup();
var opopbody=opopup.document.body;
var colorarr=["#f7f7f7","#e7e7e7","#d7d7d7","#d4d4d4","#bcbcbc","#acacac"];
var i=0;
var imaxlength=6;
var timer=null;
function showpopup()...{
var obody=document.body;
opopbody.attachevent("oncontextmenu",cancelevent);
opopbody.bgcolor="#ffffff";
var strhtml=""
strhtml+='<center><div align="center" style="border:solid 2px #00ffff;valign:middle; width:400; height:200">請您選中要操作的信件!<input type="button" value="确定" onclick="parent.hidepopup()"></div></center>';
opopbody.innerhtml=strhtml;
opopup.show(0,0,obody.clientwidth,obody.clientheight,document.body);
chgbgcolor();
function chgbgcolor()...{
if(i<imaxlength)...{
opopbody.bgcolor=colorarr[i++];
timer=settimeout(chgbgcolor,100);
else...{
cleartimeout(timer);
i=0;
function cancelevent()...{
function hidepopup()...{
opopup.hide();
//-->
<input type="button" onclick="showpopup()" value="操作有誤">
再加一個方法,帶漸變效果的