按按住鼠标左键拖动用哪个动作?onmousemove好象不对啊 结束事件是 ondragend吗?有没有拖动中的事件? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 给你个例子:<html> <head> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> <script language="javascript">function showhide(v){if(v==1) test.style.display="block";else test.style.display="none";}var div, divleft, divtop, startDrag = 0;function down(){ startDrag = 1; divleft = window.event.clientX - div.style.pixelLeft; divtop = window.event.clientY - div.style.pixelTop;}function move(){ if(startDrag == 1 ) { div.style.left = window.event.clientX - divleft; div.style.top = window.event.clientY - divtop; }}function up(){ startDrag = 0;}function loaded(){ div = document.getElementById('test');} </script> </head> <body onload="loaded()"> <div id="test" style="CURSOR: move;position:absolute;left:215px;top:115px;display:none;" onmousedown="down();" onmouseup="up()" onmousemove="move()"> <table width="80%" border="1" cellspacing="0" cellpadding="0"> <tr> <td>aaaaaaaaaaaaaaaaaaaaaaaa</td> <td>BBBBBBBBBBBBB</td> </tr> <tr> <td>CCCCCCCCCCCC</td> <td>DDDDDDDDDDDDDDDDDDDDDDDDDDDD</td> </tr> </table> </div> <input id="Button4" type="button" value="显示" onclick="showhide(1)" /> <input id="Button3" type="button" value="隐藏" onclick="showhide(0)" /> </body> </body></html> 关于js函数调用,百度地图添加标记 请问javascript中如何弹出一个对话框显示url js从一个页面如何调用另一个页面的函数 急,js问题 急 在线等 js 动态删除生成的行问题 O(∩_∩)O谢谢 有没有带悬浮提示javascript编辑器,免费的中文版 jsDoc怎么把js文件转为API文档呢? javascript中的for/in用法 请教产生随机数且判断相等的函数写法 为什么不能检测username的长度? 这个为什么会出错啊 help me 100分求层代码
<html>
<head>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function showhide(v){
if(v==1)
test.style.display="block";
else
test.style.display="none";
}
var div, divleft, divtop, startDrag = 0;
function down()
{
startDrag = 1;
divleft = window.event.clientX - div.style.pixelLeft;
divtop = window.event.clientY - div.style.pixelTop;
}function move()
{
if(startDrag == 1 )
{
div.style.left = window.event.clientX - divleft;
div.style.top = window.event.clientY - divtop;
}
}function up()
{
startDrag = 0;
}
function loaded(){
div = document.getElementById('test');
}
</script>
</head>
<body onload="loaded()">
<div id="test" style="CURSOR: move;position:absolute;left:215px;top:115px;display:none;"
onmousedown="down();" onmouseup="up()" onmousemove="move()">
<table width="80%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>aaaaaaaaaaaaaaaaaaaaaaaa</td>
<td>BBBBBBBBBBBBB</td>
</tr>
<tr>
<td>CCCCCCCCCCCC</td>
<td>DDDDDDDDDDDDDDDDDDDDDDDDDDDD</td>
</tr>
</table>
</div>
<input id="Button4" type="button" value="显示" onclick="showhide(1)" /> <input id="Button3" type="button" value="隐藏" onclick="showhide(0)" />
</body>
</body></html>