标题:图片拖动--请大家给我改改..
只看楼主
sparkldj
Rank: 2
等 级:论坛游民
帖 子:34
专家分:14
注 册:2006-11-2
 问题点数:0 回复次数:1 
图片拖动--请大家给我改改..

<SCRIPT language=JavaScript>
var cursorX,cursorY,obj=null;
var moveAble=true;
function enableMove(index){
cursorX=event.clientX;
cursorY=event.clientY;
obj=index;

}
function disableMove() {obj=null;
}
function move_ie(){
if(obj && moveAble){

DIV_name=obj.id;
moveX=event.clientX;
moveY=event.clientY;
//if(moveX>240)
//moveX=240;
//if(moveX<0)
//moveX=0;
//if(moveY>54)
//moveY=54;
//if(moveY<40)
//moveY=40;
document.all[DIV_name].style.posLeft+=moveX-cursorX;
document.all[DIV_name].style.posTop+=moveY-cursorY;
if(document.all[DIV_name].style.posLeft>226)
document.all[DIV_name].style.posLeft=226;
if(document.all[DIV_name].style.posLeft<0)
document.all[DIV_name].style.posLeft=0;
if(document.all[DIV_name].style.posTop!=40)
document.all[DIV_name].style.posTop=40;
cursorX=moveX;
cursorY=moveY;
}

}
</SCRIPT>
<table width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80" height="40">&nbsp;</td>
<td width="80">&nbsp;</td>
<td width="80">&nbsp;</td>
</tr>
<tr>
<td colspan="3" height="14" bgcolor="#000000"><span ><div id=div1 onmousemove="move_ie();" onmousedown="enableMove(this);"onmouseup="disableMove();" style="POSITION: absolute;Z-INDEX: 100; left:0; top:40; cursor:pointer"><img src="../images/498ebf94020008o6.gif" width="14" height="14"/></div></span></td>
</tr>
<tr>
<td height="40">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

我鼠标都放了,它也要动......

[此贴子已经被作者于2007-4-11 14:08:11编辑过]

搜索更多相关主题的帖子: function null 图片 
2007-04-11 14:02
sparkldj
Rank: 2
等 级:论坛游民
帖 子:34
专家分:14
注 册:2006-11-2
得分:0 

我顶,不要沉,,,,斑竹 啊


[glow=255,red,2]" target="_blank">炎と永远[/glow]
2007-04-11 14:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-131002-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.667595 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved