代码:
<html> <head> <style type="text/css"> .wins{position:absolute;visibility:hidden;border:3px;} .titlebar{position:absolute;left:0px;top:0px;width:100%;background-color:#336699;cursor:move;font-family:tahoma;} </style> <script language="javascript"> var active=0; var x,y,coordsX,coordsY; function start(windowName) { dargwind=document.getElementById(windowName); x=coordsX-parseInt(dargwind.style.top); y=coordsY-parseInt(dargwind.style.left); active=1; } function darg() { coordsY=event.clientY; coordsX=event.clientX; if(active) { dargwind.style.top=coordsY-y; dargwind.style.left=coordsX-x; } } function closewin() { dargwind.style.visibility="hidden"; } function openWin(windowName,contentName,topWin,leftWin,winWidth,winHeight) { dargwind=document.getElementById(windowName); dargcont=document.getElementById(contentName); dargwind.style.visibility="visible"; dargwind.style.top=topWin; dargwind.style.left=leftWin; dargwind.style.width=winWidth; dargwind.style.height=winHeight; dargcont.style.top=10; dargcont.style.left=0; dargcont.style.height=winHeight-24; dargcont.style.width=winWidth-20; } document.onmousemove=darg; document.onmouseup=new Function("active=0"); </script> </head> <body> <p><a href="javascript:openWin('wind1','cont1',50,300,300,200)">最新消息</a></p> <div id="wind1" class="wins"> <table width="100%" border=0 class="titlebar" onmousedown="start('wind1');"> <tr> <td>最新消息</td> </tr> </table> <span id="cont1" > <p> 美国收费最昂贵的大学的最新排行榜 ........ ......... </p> </span> </div> </body> </html>
麻烦帮我看一下,哪里有点问题,鼠标拖动的时候,窗口有点不听使奂!
|