ASP学校学生基地,原创基地,ASP优秀程序,定制程序,学校信息化教育整合系统的开始! 设为首页 添加到收藏夹 25175产品
  首页 > 网站技巧
        阅读新闻
 

可移动的图层

[日期:2007-02-11]  来源:25175  作者:admin  阅读: 次  [字体: ]

可移动的图层

<script language="JavaScript1.2">
var dragswitch=0
var nsx function drag_dropns(name){powered by 25175.net
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}


//drag drop function for IE 4+////
/////////////////////////////////

var dragapproved=false

function drag_dropie(){
if (dragapproved==true){
document.all.showimage.style.pixelLeft=tempx+event.clientX-iex
document.all.showimage.style.pixelTop=tempy+event.clientY-iey
return false
}
}

function initializedragie(){
iex=event.clientX
iey=event.clientY
tempx=showimage.style.pixelLeft
tempy=showimage.style.pixelTop
dragapproved=true
document.onmousemove=drag_dropie
}


if (document.all){
document.onmouseup=new Function("dragapproved=false")
}

////drag drop functions end here//////

function hidebox(){
if (document.all)
showimage.style.visibility="hidden"
else if (document.layers)
document.showimage.visibility="hide"
}


</script><div id=showimage style=position:absolute;width:250px;left:50;top:50><table border=0 width=250 bgcolor=#ffffff cellspacing=0 cellpadding=2><tr><td width=100%>
<table border=3 width=100% cellspacing=2 cellpadding=0 height=100 bordercolor="#FF99CC">
<tr>
<td onMousedown=initializedragie() style=cursor:hand width=94% height="17" align="center" bgcolor="#FFE1F5" valign="bottom">
<b><small><font size="2">可移动的图层</font></small></b></td><td style=cursor:hand height="17" width="6%"><a href=# onClick="hidebox();return false"><img src=../../../images/119.gif border=0></a></td></tr>
<tr bgcolor="#FFFFFF" align="center">
<td style=padding:4px colspan=2>
<p>欢迎光临</p></td></tr></table></td></tr></table></div>



推荐给朋友 】 【 打印此文章 】 【 加入收藏
 

上一篇:跟随鼠标的图片
下一篇:随鼠标移动而变化的图片

       相关新闻   移动 

       本文评论   所有评论
 
 

点评: 字数
姓名:

.
网站制作 | 广告服务 | 产品价格 | 汇款方式 | 购买指南 | 程序制作 |
技术支持 | idc.25175.net
Copyright © 2005-2008 25175. All Rights Reserved powered by 25175 | 浙ICP备05022281 | 法律顾问:陈淑丽