<style type=\"text/css\">
body,td,a {
font-size: 9pt;
color: #330000;
text-decoration: none
}.aa {
filter:alpha(opacity=70);
}</style>
<div style=\"position:absolute; left:235px; top:92px;solid;cursor:move\" onmousedown=\"down1(this)\" class=\"aa\" id=plane0>
<table cellpadding=\"0\" border=\"0\" cellspacing=\"1\" width=\"200\" height=\"100\" bgcolor=\"#000000\" >
<tr><td height=\"18\" bgcolor=\"#999999\" ><div align=\"right\">关闭>>><a href=\"#\" onClick=\"clase(0)\">★</a></div></td></tr>
<tr><td bgcolor=\"f4f4f4\">这里是你的文字!!!!!!!!!!!!!!!!!!</td></tr></table></div><div style=\"position:absolute;left:350px;top:172px;z-index:1;solid;cursor:move\" id=plane1 onmousedown=\"down1(this)\" class=\"aa\">
<table cellpadding=\"0\" border=\"0\" cellspacing=\"1\" width=\"200\" height=\"100\" bgcolor=\"#000000\" >
<tr><td height=\"18\" bgcolor=\"#999999\" ><div align=\"right\">关闭>>><a href=\"#\" onClick=\"clase(1)\">★</a></div></td></tr>
<tr><td bgcolor=\"f4f4f4\">这里是你的文字!!!!!!!!!!!!!!!!!!</td></tr></table></div><script>
//the keyword \"down\" is the flag of mousedown or mouseup
var down=false,divleft,divtop,n;function clase(x){document.all['plane'+x].style.visibility='hidden'}
//event.clientX and event.clientY 的用法,是当前鼠标的坐标
function down1(m){
n=m;
down=true;
divleft=event.clientX-parseInt(m.style.left);
divtop=event.clientY-parseInt(m.style.top);
//document.write(event.clientX+\"---\"+event.clientY+\"---\"+parseInt(m.style.left)+\"---\"+parseInt(m.style.top)+\"---\"+divleft+\"---\"+divtop);
}function move(){
if(down)
{
n.style.left=event.clientX-divleft;
n.style.top=event.clientY-divtop;
}
}
</script>
把窗口移到这儿看看吧!<!--id.style的用法-->
<a href=\"javascript:\" onClick=\"plane0.style.visibility='visible'\">点这儿重新显示0</a>
<a href=\"javascript:\" onClick=\"plane1.style.visibility='visible'\">点这儿重新显示1</a>
第二步:把<body>中的内容改为:
<body bgcolor=\"#fef4d9\" onmousemove=\"move()\" onmouseup=\"down=false\">
偶当斑竹的第一个帖子
程序代码: