可以移动的自定义Alert

<style>
a.aa:link{text-decoration:none;color:red}
a.aa:hover{text-decoration:none;color:red}
</style>
<body topmargin=0 leftmargin=0>
<div id="d" style="position:absolute;z-index:1;filter:alpha(opacity=50);background-color:#000000;visibility:hidden"><span style="position:relative">
<!--<center><br><br><br><br><br><br>
<table width=200 height=150 border=1 bordercolor="#000000" style="border-collapse:collapse;background-color:#FFFFFF">
<tr><td valign=middle align=center style="color:red" height=25>123131312</td></tr>
<tr><td valign=middle align=center><a href="javascript:;" onClick="hide()" class="aa" style="color:#000000">关闭</a></td></tr>
</table>
</center> --></span>
</div>
<!--    浮层框架开始    -->
      <div id="Dialogdiv" align="center" style="position:absolute; z-index:3; width: 480; height:180px;left:expression((document.body.offsetWidth-540)/2); top: expression((document.body.offsetHeight-170)/2);background-color:#fff;display:none;" valign="center">
   <TABLE width=540 height=170 border=1 cellpadding=0 cellspacing=0 style="border:1px 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">系统警告</TD>
   </TR>
   <TR>
    <TD align="center" valign="center">对不起 出错了<span id="Errmsg"></span></TD>
   </TR>
   <TR>
    <TD style="background-color:#f7f7f7;" height=30 align="center"><INPUT TYPE="button" value="&nbsp;&nbsp;确&nbsp;&nbsp;定&nbsp;&nbsp;" onClick="hide()"></TD>
   </TR>
   </TABLE>
<iframe src="" style="position:absolute; visibility:inherit;top:0px; left:0px; width:480px; height:181px; z-index:-1; filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';"></iframe>
</div>
<!--    浮层框架结束    -->
&nbsp;&nbsp;&nbsp;&nbsp;
<li><a href="javascript:;" onClick="show('出错信息aa')">查看</a>
  <table cellpadding="0" cellspacing="3" width="100%">
    <tr align="center">
      <td height="40" colspan="3"><strong><font color="#000099">标题:</font><font color="#FF6600">
        这是一个测试表单</font></strong></td>
    </tr>
    <tr>
      <td width="198" height="40" align="right">您的新浪会员名:</td>
      <td width="250" align="left"><input id="loginname_uMessage" name="loginname"  type="text" width="150px"/></td>
      <td align="left" width="531"><table cellpadding="1" cellspacing="0">
          <tr>
            <td><table>
                <tr>
                  <td id="uMessage"><font color="#999999">请输入您的新浪会员名(新浪VIP邮箱用户请输入:
                    邮箱名.vip)。 </font></td>
                </tr>
              </table></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td height="35" align="right">您的会员密码:</td>
      <td align="left"><input id="passwordsina_pMessage"  onFocus="return sl('pMessage');" name="passwd" type="password" width="150px"/></td>
      <td align="left"><table cellpadding="1" cellspacing="0">
          <tr>
            <td><table>
                <tr>
                  <td id="pMessage"><font color="#999999">请输入您的会员密码。</font></td>
                </tr>
              </table></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td colspan="3" style="padding:8px 0 5px 50px">为了保障您的空间安全,我们建议您使用6-16位的密码,若您的密码小于6位,请务必<a href="http://unipro.sina.com.cn/chginfo_pw.html" target="_blank"><font color='red'><u>点击此处修改</u></font></a></td>
    </tr>
    <tr>
      <td height="35" align="right">密码查询问题:</td>
      <td align="left"><select id="pwdQ_pwdMsg" name="pwdQ" >
          <option selected value="">--请您选择--</option>
          <option value="我的宠物名字?">我的宠物名字?</option>
          <option value="我最好的朋友是谁?">我最好的朋友是谁?</option>
          <option value="我最喜爱的颜色?">我最喜爱的颜色?</option>
          <option value="我最喜爱的电影?">我最喜爱的电影?</option>
          <option value="我最喜爱的影星?">我最喜爱的影星?</option>
          <option value="我最喜爱的歌曲?">我最喜爱的歌曲?</option>
          <option value="我最喜爱的食物?">我最喜爱的食物?</option>
          <option value="我最大的爱好?">我最大的爱好?</option>
          <option value="我中学校名全称是什么?">我中学校名全称是什么?</option>
          <option value="我的座右铭是?">我的座右铭是?</option>
          <option value="我最喜欢的小说的名字?">我最喜欢的小说的名字?</option>
          <option value="我最喜欢的卡通人物名字?">我最喜欢的卡通人物名字?</option>
          <option value="我母亲/父亲的生日?">我母亲/父亲的生日?</option>
          <option value="我最欣赏的一位名人的名字?">我最欣赏的一位名人的名字?</option>
          <option value="我最喜欢的运动队全称?">我最喜欢的运动队全称?</option>
          <option value="我最喜欢的一句影视台词?">我最喜欢的一句影视台词?</option>
          <!-- <option value=9>其他</option> -->
        </select></td>
      <td align="left"><table cellpadding="1" cellspacing="0">
          <tr>
            <td><table>
                <tr>
                  <td id="pMessage"><font color="#999999">请输入您的会员密码。</font></td>
                </tr>
              </table></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td height="35" align="right">密码查询问题:</td>
      <td align="left"><select id="pwdQ_pwdMsg" name="pwdQ" >
          <option selected value="">--请您选择--</option>
          <option value="我的宠物名字?">我的宠物名字?</option>
          <option value="我最好的朋友是谁?">我最好的朋友是谁?</option>
          <option value="我最喜爱的颜色?">我最喜爱的颜色?</option>
          <option value="我最喜爱的电影?">我最喜爱的电影?</option>
          <option value="我最喜爱的影星?">我最喜爱的影星?</option>
          <option value="我最喜爱的歌曲?">我最喜爱的歌曲?</option>
          <option value="我最喜爱的食物?">我最喜爱的食物?</option>
          <option value="我最大的爱好?">我最大的爱好?</option>
          <option value="我中学校名全称是什么?">我中学校名全称是什么?</option>
          <option value="我的座右铭是?">我的座右铭是?</option>
          <option value="我最喜欢的小说的名字?">我最喜欢的小说的名字?</option>
          <option value="我最喜欢的卡通人物名字?">我最喜欢的卡通人物名字?</option>
          <option value="我母亲/父亲的生日?">我母亲/父亲的生日?</option>
          <option value="我最欣赏的一位名人的名字?">我最欣赏的一位名人的名字?</option>
          <option value="我最喜欢的运动队全称?">我最喜欢的运动队全称?</option>
          <option value="我最喜欢的一句影视台词?">我最喜欢的一句影视台词?</option>
          <!-- <option value=9>其他</option> -->
        </select></td>
      <td align="left"><table cellpadding="1" cellspacing="0">
          <tr>
            <td><table>
                <tr>
                  <td id="pMessage"><font color="#999999">请输入您的会员密码。</font></td>
                </tr>
              </table></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td height="35" align="right">密码查询答案:</td>
      <td align="left"><input id="pwdA_pwdAMsg" name="pwdA" onBlur="regCheck(this)" onChange="regCheck(this)" type="text" width="150px"/></td>
      <td  style="padding-left:10px"><table>
          <tr>
            <td id="pwdAMsg"><font color="#999999">6个字母、数字或3个汉字以上(包括6个)、不要含有空格。</font></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td height="35" align="right">性别:</td>
      <td align="left"><input id="sex_sexMsg" onClick="regCheck(this)" type="radio" name="sex" value="1" class="chkinput"/>
        男&nbsp; <input id="sex2_sexMsg" type="radio" onClick="regCheck(this)" name="sex" value="2" class="chkinput">
        女</td>
      <td  style="padding-left:10px"><table>
          <tr>
            <td width="379" id="sexMsg"><font color="#999999">正确填写基本信息,有利于您与您的朋友进行真诚交流。</font></td>
          <tr> </table></td>
    </tr>
    <tr>
      <td height="35" align="right">密码查询答案:</td>
      <td align="left"><input id="pwdA_pwdAMsg" name="pwdA" onBlur="regCheck(this)" onChange="regCheck(this)" type="text" width="150px"/></td>
      <td  style="padding-left:10px"><table>
          <tr>
            <td id="pwdAMsg"><font color="#999999">6个字母、数字或3个汉字以上(包括6个)、不要含有空格。</font></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td height="35" align="right">邮编:</td>
      <td align="left"><input type="text" name="textfield"></td>
      <td  style="padding-left:10px"><table>
          <tr>
            <td id="pwdAMsg"><font color="#999999">6个字母、数字或3个汉字以上(包括6个)、不要含有空格。</font></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td height="35" align="right">国家1:</td>
      <td align="left"><input type="text" name="textfield2"></td>
      <td  style="padding-left:10px"><table>
          <tr>
            <td id="pwdAMsg"><font color="#999999">6个字母、数字或3个汉字以上(包括6个)、不要含有空格。</font></td>
          </tr>
        </table></td>
    </tr>
  <tr>
      <td height="35" align="right">国家2:</td>
      <td align="left"><input type="text" name="textfield2"></td>
      <td  style="padding-left:10px"><table>
          <tr>
            <td id="pwdAMsg"><font color="#999999">6个字母、数字或3个汉字以上(包括6个)、不要含有空格。</font></td>
          </tr>
        </table></td>
    </tr>
  <tr>
      <td height="35" align="right">国家3:</td>
      <td align="left"><input type="text" name="textfield2"></td>
      <td  style="padding-left:10px"><table>
          <tr>
            <td id="pwdAMsg"><font color="#999999">6个字母、数字或3个汉字以上(包括6个)、不要含有空格。</font></td>
          </tr>
        </table></td>
    </tr>
  <tr>
      <td height="35" align="right">国家4:</td>
      <td align="left"><input type="text" name="textfield2"></td>
      <td  style="padding-left:10px"><table>
          <tr>
            <td id="pwdAMsg"><font color="#999999">6个字母、数字或3个汉字以上(包括6个)、不要含有空格。</font></td>
          </tr>
        </table></td>
    </tr>

    <tr align="center">
      <td height="35" colspan="3"><form name="form1" method="post" action="">
          <input type="button" name="Submit" value="  我要提交  " onclick="info('aaaaa');show();">
          <input type="button" name="Submit" value="  我要提交2  " onclick="info('nnnnnnn');show();">
        </form></td>
    </tr>
  </table>
<script>
var obj=document.getElementById("d");
var Dialog_div=document.getElementById("Dialogdiv");
var t=new Object();
var Err_msg;
function info(errorinfo)
{Err_msg=errorinfo;}
function show(){
obj.style.visibility="visible";
obj.style.width=document.body.scrollWidth;
obj.style.height=document.body.scrollHeight;
Dialog_div.style.top=(parseInt(document.body.clientHeight)-parseInt(Dialog_div.style.height))/2+document.body.scrollTop-100;  
Dialog_div.style.left=(parseInt(document.body.clientWidth)-parseInt(Dialog_div.style.width))/2+document.body.scrollLeft;  
document.all.Errmsg.innerText=Err_msg;
Dialog_div.style.display='block';
if(obj.filters.alpha.opacity>25){
  obj.filters.alpha.opacity=25;
  clearTimeout(t.timer1);
  return;
}else{
  obj.filters.alpha.opacity+=2;
  t.timer1=setTimeout("show()",20)
}
return;
}
function hide(){
if(obj.filters.alpha.opacity<=0){
  obj.filters.alpha.opacity=0;
  obj.style.visibility="hidden"
  Dialog_div.style.display='none';
  clearTimeout(t.timer2);
  document.all.loginname.focus();
  return;
}else{
  obj.filters.alpha.opacity-=2;
  t.timer2=setTimeout("hide()",20);
}
return;
}
</script>
<Script language="JavaScript1.2">
//把这里写成一个js文件为floate.js,减少代码量.因为论坛上要运行,我就把所有的代码插到这里了----开始
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
<!-- STALKER CODE -->
function heartBeat() {
if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
if(diffY != lastScrollY) {
percent = .1 * (diffY - lastScrollY);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) Dialogdiv.style.pixelTop += percent;
if(NS) Dialogdiv.top += percent;
lastScrollY = lastScrollY + percent;
}
if(diffX != lastScrollX) {
percent = .1 * (diffX - lastScrollX);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) Dialogdiv.style.pixelLeft += percent;
if(NS) Dialogdiv.left += percent;
lastScrollX = lastScrollX + percent;
}
}
<!-- /STALKER CODE -->
<!-- DRAG DROP CODE -->
function checkFocus(x,y) {
stalkerx = Dialogdiv.pageX;
stalkery = Dialogdiv.pageY;
stalkerwidth = Dialogdiv.clip.width;
stalkerheight = Dialogdiv.clip.height;
if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;
else return false;
}
function grabIt(e) {
if(IE) {
whichIt = event.srcElement;
while (whichIt.id.indexOf("Dialogdiv") == -1) {
whichIt = whichIt.parentElement;
if (whichIt == null) { return true; }
}
whichIt.style.pixelLeft = whichIt.offsetLeft;
whichIt.style.pixelTop = whichIt.offsetTop;
currentX = (event.clientX + document.body.scrollLeft);
currentY = (event.clientY + document.body.scrollTop);
} else {
window.captureEvents(Event.MOUSEMOVE);
if(checkFocus (e.pageX,e.pageY)) {
whichIt = Dialogdiv;
StalkerTouchedX = e.pageX-Dialogdiv.pageX;
StalkerTouchedY = e.pageY-Dialogdiv.pageY;
}
}
return true;
}
function moveIt(e) {
if (whichIt == null) { return false; }
if(IE) {
newX = (event.clientX + document.body.scrollLeft);
newY = (event.clientY + document.body.scrollTop);
distanceX = (newX - currentX); distanceY = (newY - currentY);
currentX = newX; currentY = newY;
whichIt.style.pixelLeft += distanceX;
whichIt.style.pixelTop += distanceY;
if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;
if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft;
if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;
if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;
event.returnValue = false;
} else {
whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);
if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;
if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;
if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;
if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;
return false;
}
return false;
}
function dropIt() {
whichIt = null;
if(NS) window.releaseEvents (Event.MOUSEMOVE);
return true;
}
<!-- DRAG DROP CODE -->
if(NS) {
window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
window.onmousedown = grabIt;
window.onmousemove = moveIt;
window.onmouseup = dropIt;
}
if(IE) {
document.onmousedown = grabIt;
document.onmousemove = moveIt;
document.onmouseup = dropIt;
}
//if(NS || IE) action = window.setInterval("heartBeat()",1);
//把上面这段代码写成一个js文件为floate.js,减少代码量.因为论坛上要运行,我就把所有的代码插到这里了.----结束
</Script>
</body>

你可能感兴趣的:(框架,IE,影视)