<!-- 把下列代码加到HEAD区域内-->
<HEAD>
<style type="text/css">
<!--
.dragme{position:relative;}
-->
</style>
<script type="text/javascript">
<!-- The JavaScript Source!! http://webjx.com -->
<!-- Begin
var ie=document.all;
var nn6=document.getElementById&&!document.all;
var isdrag=false;
var x,y;
var dobj;
function movemouse(e)
{
if (isdrag)
{
dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;
dobj.style.top = nn6 ? ty + e.clientY - y : ty + event.clientY - y;
return false;
}
}
function selectmouse(e)
{
var fobj = nn6 ? e.target : event.srcElement;
var topelement = nn6 ? "HTML" : "BODY";
while (fobj.tagName != topelement && fobj.className != "dragme")
{
fobj = nn6 ? fobj.parentNode : fobj.parentElement;
}
if (fobj.className=="dragme")
{
isdrag = true;
dobj = fobj;
tx = parseInt(dobj.style.left+0);
ty = parseInt(dobj.style.top+0);
x = nn6 ? e.clientX : event.clientX;
y = nn6 ? e.clientY : event.clientY;
document.onmousemove=movemouse;
return false;
}
}
document.onmousedown=selectmouse;
document.onmouseup=new Function("isdrag=false");
// End -->
</script>
</HEAD>
<!--把下列代码加到body区域内,可以给自己的连接加上: class="dragme" -->
<BODY>
<div align="center">
<img src="/img/200406302.jpg" width="210" height="96" class="dragme"><br><br>
<img src="/img/200406301.jpg" width="210" height="96" class="dragme">
</div>
<p><center>
<font>用鼠标可以拖动图片<br>
by <a href="http://webjx.com">网页教学网</a></font>
</center><p>
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]