首 页 ASP ASP.NET PHP JSP Ajax DIV+CSS JavaScript XML C#
MySQL MSSQL Access Oracle Linux Server 电脑技巧 网络安全 建站经验 其它

DIV拖动实例

整理日期:2007年08月14日 【字体:


伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-08/1187055020.html
if (!e) e = window.event;
 if (dragok){
 d.style.left = dx + e.clientX - x + "px";
 d.style.top = dy + e.clientY - y + "px";
 return false;
 }
}

function down(e){
if (!e) e = window.event;
var temp = (typeof e.target != "undefined")?e.target:e.srcElement;
if (temp.tagName != "HTML"|"BODY" && temp.className != "dragclass"){
 temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
 }
//如果事件是发生在 TR标签,则..
if('TR'==temp.tagName){
//指向 TBODY 标签
temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
//指向 TABLE 标签
temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
//指向 DIV 标签,这样就可以移动啦
temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
}

if (temp.className == "dragclass"){
 if (window.opera){
 document.getElementById("Q").focus();
 }
 dragok = true;
 temp.style.zIndex = n++;
 d = temp;
Tags:
DIV拖动实例
'http://www.etoow.com/html/2007-08/1187055020.html
1
 
2
信息搜索
  
联系我们关于本站广告服务设为首页 收藏本站友情链接网站地图
Copyright © Etoow.com Inc. All Rights Reserved