此方法只能用于,IE,火狐好像没效果
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>提示信息框</title>
<style type="text/css">
a{ color:#000; font-size:12px;text-decoration:none}
a:hover{ color:#900; text-decoration:underline}
body{background:;filter:progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#ffffff,endColorStr=#003366); overflow:hidden}
#massage_box{ position:absolute; left:expression((body.clientWidth-350)/2); top:expression((body.clientHeight-200)/2); width:350px; height:200px;filter:dropshadow(color=#666666,offx=3,offy=3,positive=2); z-index:2; visibility:hidden}
#mask{ position:absolute; top:0; left:0; width:expression(body.scrollWidth); height:expression(body.scrollHeight); background:#666; filter:ALPHA(opacity=60); z-index:1; visibility:hidden}
.massage{border:#036 solid; border-width:1 1 3 1; width:95%; height:95%; background:#fff; color:#036; font-size:12px; line-height:150%}
.header{background:#036; height:10%; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; padding:3 5 0 5; color:#fff}
</style>
<!--实现层移动-->
<script language="javascript">
var Obj=''
document.onmouseup=MUp
document.onmousemove=MMovefunction MDown(Object){
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}function MMove(){
if(Obj!=''){
  document.all(Obj).style.left=event.x-pX;
  document.all(Obj).style.top=event.y-pY;
  }
}function MUp(){
if(Obj!=''){
  document.all(Obj).releaseCapture();
  Obj='';
  }
}
</script>
</head><body>
<div id="massage_box"><div class="massage">
<div class="header" onmousedown=MDown(massage_box)><div style="display:inline; width:150px; position:absolute">本站提示信息</div>
<span onClick="massage_box.style.visibility='hidden'; mask.style.visibility='hidden'" style="float:right; display:inline; cursor:hand">×</span></div>
<ul style="margin-right:25"><li>本人申明此博客所有文章(包括文章插图)均为原创,如需引用或转载请注明出处。 
</li><li>欢迎大家对博文中观点留言评述,谢绝无聊人士无素质无观点的灌水漫骂。</li><li>本站已设背景音乐,听音乐盒中收集的音乐时请先到页面底部关闭背景音乐。</li></ul></div></div>
<div id="mask"></div>
<span onClick="mask.style.visibility='visible';massage_box.style.visibility='visible'" style="cursor:hand"><a href="#">显示提示信息</a></span>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><p>查找更多代码,请访问:<a href="http://www.lanrentuku.com" target="_blank">懒人图库</a></p></body>
</html>

解决方案 »

  1.   

    何必如此费劲,下个jquery-ui多方便
      

  2.   

    这不是1句2句能说清楚的。总之。在IE下的window.event与W3C标准的e参数决定了之后的事都要分开考虑了
      

  3.   

    jquery-ui 不主是不会用这玩意
      

  4.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>wujinjian</title>
    <script type="text/javascript">
    var divobj;
    var isDown=false;
    var isFirst=true;
    var divx=0;
    var divy=0; function createDiv()
    {
    divobj=document.createElement("div"); divobj.style.position="absolute";
    divobj.style.left="0px";
    divobj.style.top="0px";
    divobj.style.width="100px";
    divobj.style.height="80px";
    divobj.style.backgroundColor="red"; divobj.style.filter="alpha(opacity=10)";
    divobj.style.MozOpacity=0.1;
    divobj.style.MozUserSelect="none"; document.body.appendChild(divobj); divobj.onmousedown=function()
    {
    isDown=true;
    }; document.onmouseup=function()
    {
    isDown=false;
    isFirst=true;
    }; document.onmousemove=mouseMove;
    } function mouseMove(e)
    {
    if(isDown)
    {
    if(e==null)
    e=window.event;

    var x=e.clientX;
    var y=e.clientY; if(isFirst)
    {
    isFirst=false;

    divx=x-(divobj.style.left.replace("px","")-0);

    divy=y-(divobj.style.top.replace("px","")-0);
    } divobj.style.left=x-divx+"px";
    divobj.style.top=y-divy+"px";
    }
    }
    </script>
    </head>
    <body onload="createDiv()" >

    </body>
    </html>
      

  5.   

    用 event.screenX event.screenY 最快,最符合标准,注意,只取偏移值,也就是 鼠标按下的screen值,和每次移动时产生的 screen 值,的差 ,用到对象上去就好了
      

  6.   

    还有,FF是不支持滤镜filter的
      

  7.   

    用JqueryUI就行了,超级简单的。www.jqueryui.com加载JqueryUI前先加载Jquerywww.jquery.com
      

  8.   

    随便写个你拿去改好了,cup10%以下<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></HEAD> <BODY style="height:800px;">
    <div id="tee" style="width:200px; height:200px; background:#f00; position:absolute; cursor:move"></div>
    <script type="text/javascript">
    var tee=document.getElementById('tee');

    tee.onmousedown=function(e){
    e=e || event;
    start(e,this);
    e.cancelBubble=true;
    return false;
    }
    function start(e,o)
    {
    var i,
    x,
    y;
    i=0;
    x=e.screenX-o.offsetLeft;
    y=e.screenY-o.offsetTop;

    if(window.addEventListener)
    {
    window.document.addEventListener('mousemove',moving,false)
    window.document.addEventListener('mouseup',end,false)
    }else{
    window.document.attachEvent('onmousemove',moving)
       window.document.attachEvent('onmouseup',end)   }
    function moving(e)
    {
    if(i++^6)//计数器, 如果i=6 则 i^6==0
    return;
    o.style.left=(e.screenX-x)+'px';
    o.style.top=(e.screenY-y)+'px';
    i=0;

    } function end(e)
    {
    if(window.addEventListener)
    {
    window.document.removeEventListener('mousemove',moving,false);
    document.removeEventListener('mouseup',arguments.callee,false);
    }else{
    window.document.detachEvent('onmousemove',moving);
    window.document.detachEvent('onmouseup',arguments.callee);  }

    window.document.body.focus() // ff 3.0
    }

    }// end start
    </script>
     </BODY>
    </HTML>