会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
烈马狂生
博客园
首页
新随笔
联系
订阅
管理
[转自横渡博客]鼠标拖动
<
div id
=
"
divMove
"
style
=
"
POSITION: absolute;left:300;top:300
"
onselectstart
=
"
return false
"
onmousedown
=
"
MouseDown(this)
"
onmousemove
=
"
MouseMove()
"
>
<
table width
=
"
150
"
cellpadding
=
"
0
"
cellspacing
=
"
0
"
border
=
"
1
"
>
<
tr
>
<
td height
=
"
30
"
bgcolor
=
"
#cccccc
"
>
title
</
td
>
</
tr
>
<
tr
>
<
td height
=
"
100
"
><
p align
=
"
center
"
>
testMove
</
p
></
td
>
</
tr
>
</
table
>
</
div
>
<
SCRIPT LANGUAGE
=
"
JavaScript
"
>
<!--
var
currentMoveObj
=
null
;
var
relLeft,relTop;
function
MouseDown(obj)
{
currentMoveObj
=
obj;
currentMoveObj.style.position
=
"
absolute
"
;
relLeft
=
event.x
-
currentMoveObj.style.pixelLeft;
relTop
=
event.y
-
currentMoveObj.style.pixelTop;
}
window.document.onmouseup
=
function
()
{
currentMoveObj
=
null
;
}
function
MouseMove()
{
if
(currentMoveObj
!=
null
)
{
currentMoveObj.style.pixelLeft
=
event.x
-
relLeft;
currentMoveObj.style.pixelTop
=
event.y
-
relTop;
}
}
//
-->
</
SCRIPT
>
posted @
2005-04-17 14:24
烈马狂生
阅读(
443
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告