js+div实现拖拽.doc
文本预览下载声明
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN /TR/xhtml1/DTD/xhtml1-transitional.dtd
html xmlns=/1999/xhtml
head
meta http-equiv=Content-Type content=text/html; charset=utf-8 /
title框架自定义拖拽/title
style
body {
margin:0px;
padding:0px;
font-size:12px;
text-align:center;
}
body div {
text-align:center;
margin-right:auto;
margin-left:auto;
}
.content {
width:900px;
}
.content .left {
float:left;
width:20%;
border:1px solid #FF0000;
margin:3px;
}
.content .center {
float:left;
border:1px solid #FF0000;
margin:3px;
width:57%
}
.content .right {
float:right;
width:20%;
border:1px solid #FF0000;
margin:3px
}
.mo {
height:auto;
border:1px solid #CCC;
margin:3px;
background:#FFF
}
.mo h1 {
background:#ECF9FF;
height:18px;
padding:3px;
cursor:move
}
.mo .nr {
height:80px;
border:1px solid #F3F3F3;
margin:2px
}
h1 {
margin:0px;
padding:0px;
text-align:left;
font-size:12px
}
/style
script
var dragobj={}
window.onerror=function(){return false}
function on_ini(){
Stotype.inc=function(s){return this.indexOf(s)-1?true:false}
var agent=navigator.userAgent
window.isOpr=agent.inc(Opera)
window.isIE=agent.inc(IE)!isOpr
window.isMoz=agent.inc(Mozilla)!isOpr!isIE
if(isMoz){
Etotype.__defineGetter__(x,function(){return this.clientX+2})
Etotype.__defineGetter__(y,function(){return this.clientY+2})
}
basic_ini()
}
function basic_ini(){
window.$=function(obj){return typeof(obj)==string?document.getElementById(obj):obj}
window.oDel=function(obj){if($(obj)!=null){$(obj).parentNode.removeChild($(obj))}}
}
window.onload=function(){
on_ini()
var o=document.getElementsByTagName(h1)
显示全部