运营
安全
论文
办公
模板
欣赏
QQ
SVG
认证
视频
建站
素材
游戏
辞典
CMS
管理
互联网
硬件
本本
网吧
业界
souzz:www.souzz.net
首页
编程开发
源码下载
网页模板
网页设计
图形图像
安全技术
人物
存储
Cisco
数据库
服务器
网站运营
登陆
|
注册
|
文章投稿
|
信息订阅
|
站长社区
|
繁体版
智能模糊搜索
仅搜索标题
热门关键字:
PHP
Cisco
seo
网络广告
虚拟主机
中文域名
当前位置 :
|
主页
>
网页特效
>
图形图象
>
图片随意移动,可以拖动图片
来源:
作者:
时间:
2005-12-31
点击:
<HTML> <HEAD> <META http-equiv='Content-Type' content='text/html; charset=gb2312'> <TITLE>
图片
随意移动,可以拖动
图片
</TITLE> </HEAD> <BODY bgcolor="#fef4d9" onLoad="init()"> <style type="text/css"> #plane1 {position:absolute; left:290; top:170; width:121; z-index:0} #plane2 {position:absolute; left:400; top:250; width:118; z-index:0} </style> <SCRIPT LANGUAGE="JavaScript"> //Modified by the CoffeeCup HTML Editor++ //http://www.coffeecup.com // Global variables for platform branching var isNav, isIE if (parseInt(navigator.appVersion) >= 4) { if (navigator.appName == "Netscape") { isNav = true } else { isIE = true } } // ***Begin CSS custom API Functions*** // Set zIndex property function setZIndex(obj, zOrder) { obj.zIndex = zOrder } // Position an object at a specific pixel coordinate function shiftTo(obj, x, y) { if (isNav) { obj.moveTo(x,y) } else { obj.pixelLeft = x obj.pixelTop = y } } // ***End API Functions*** // Global holds reference to selected element var selectedObj // Globals hold location of click relative to element var offsetX, offsetY // Find out which element has been clicked on function setSelectedElem(evt) { if (isNav) { // declare local var for use in upcoming loop var testObj // make copies of event coords for use in upcoming loop var clickX = evt.pageX var clickY = evt.pageY // loop through all layers (starting with frontmost layer) // to find if the event coordinates are in the layer for (var i = document.layers.length - 1; i >= 0; i--) { testObj = document.layers[i] if ((clickX > testObj.left) && (clickX < testObj.left + testObj.clip.width) && (clickY > testObj.top) && (clickY < testObj.top + testObj.clip.height)) { // if so, then set the global to the layer, bring it // forward, and get outa here selectedObj = testObj setZIndex(selectedObj, 100) return } } } else { // use IE event model to get the targeted element var imgObj = window.event.srcElement // make sure it's one of our planes if (imgObj.parentElement.id.indexOf("plane") != -1) { // then set the global to the style property of the element, // bring it forward, and say adios selectedObj = imgObj.parentElement.style setZIndex(selectedObj,100) return } } // the user probably clicked on the background selectedObj = null return } // Drag an element function dragIt(evt) { // operate only if a plane is selected if (selectedObj) { if (isNav) { shiftTo(selectedObj, (evt.pageX - offsetX), (evt.pageY - offsetY)) } else { shiftTo(selectedObj, (window.event.clientX - offsetX), (window.event.clientY - offsetY)) // prevent further system response to dragging in IE return false } } } // Set globals to connect with selected element function engage(evt) { setSelectedElem(evt) if (selectedObj) { // set globals that remember where the click is in relation to the // top left corner of the element so we can keep the element-to-cursor // relationship constant throughout the drag if (isNav) { offsetX = evt.pageX - selectedObj.left offsetY = evt.pageY - selectedObj.top } else { offsetX = window.event.offsetX offsetY = window.event.offsetY } } // block mouseDown event from forcing Mac to display // contextual menu. return false } // Restore elements and globals to initial values function release(evt) { if (selectedObj) { setZIndex(selectedObj, 0) selectedObj = null } } // Turn on event capture for Navigator function setNavEventCapture() { if (isNav) { document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP) } } // Assign event handlers used by both Navigator and IE (called by onLoad) function init() { if (isNav) { setNavEventCapture() } // assign functions to each of the events (works for both Navigator and IE) document.onmousedown = engage document.onmousemove = dragIt document.onmouseup = release } </SCRIPT> <DIV ID=plane1><IMG NAME="planePic1" SRC="/img/newlogo.gif" BORDER=0></DIV> <DIV ID=plane2><IMG NAME="planePic1" SRC="/img/01.gif" BORDER=0></DIV> </BODY></HTML>
[
收藏
]
[
推荐
]
[
评论
]
[
打印
]
[
关闭
]
上一篇:
图片隐现效果的脚本
下一篇:
图片大小变换
最新评论
共有 0 位网友发表了评论
查看所有评论
发表评论
评论内容:
不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名:
密码:
匿名?
注册
赞助商连接
热点关注
不停闪烁的图片
图片幻灯片效果
一段实用的图片滚动显示代
图象淡入淡出效果,鼠标移
大雁南飞(请注意改变图片
随机显示的背景图片 刷新
禁止图片右键下载的脚本
图片显示特效 有点像行扫
随机显示图片脚本,刷新看
自由设定图片大小
图象翻转 鼠标移上去看效
图片响应鼠标变换
图片随意移动,可以拖动图
图片的渐显播放
图象滚动公告版[适合做图
左右移动的图片
鼠标点击效果,的确很酷
图片不停闪烁
跟随鼠标的图片
自由控制显示图片大小,鼠
相关文章
图象淡入淡出效果,鼠标移
图片显示特效 有点像行扫
禁止图片右键下载的脚本
图形选择脚本
自由设定图片大小
图形左右晃动脚本
自由控制图片下载
图片自由运动
图片响应鼠标变换
图片大小变换