в чём выражаеться глюк я так и непонял...можно мне на пальцах обьяснить? )))
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<style type="text/css">
body{margin:0px;}
#drag * {cursor:move; border: 1px solid #CCCCCC; background-color: #EEEEEE; width:200px; height:20px; z-index:1;}
.dragging {z-index:2; opacity:0.8; FILTER: Alpha(opacity=80);}
.draggingReset {z-index:1; opacity:1.0; FILTER: none;}
</style>
<script language="JavaScript" type="text/javascript">
var ua = navigator.userAgent.toLowerCase();
isIE = ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1;
isOpera = ua.indexOf("opera") != -1;
isGecko = ua.indexOf("gecko") != -1;
isSafari = ua.indexOf("safari") != -1;
isKonqueror = ua.indexOf("konqueror") != -1;
document.onmousedown = OnMouseDown;
document.onmousemove = OnMouseMove;
document.onmouseup = OnMouseUp;
var stating = 0,
DRAG = false;
function OnMouseDown(a) {
if (a == null) a = a || window.event;
target = a.target || a.srcElement;
action_obj = target.id;
offsetY = isIE ? a.offsetY : a.pageY - target.offsetTop;
distance = 0;
dragObjects = document.getElementById("drag").getElementsByTagName("*");
for (a = 0; a < dragObjects.length; a++) {
if (dragObjects[a].id == action_obj) action_obj = a;
dragObjects[a].start = dragObjects[a].offsetTop;
dragObjects[a].height = dragObjects[a].clientHeight + 2
}
if (stating == 0) {
for (a = 0; a < dragObjects.length; a++) {
dragObjects[a].style.position = "absolute";
dragObjects[a].style.top = dragObjects[a].start+"px"
}
stating = 1
}
DRAG = true
}
function OnMouseMove(a) {
if (DRAG == true) {
if (a == null) a = a || window.event;
distance = 0;
Y = a.clientY + document.body.scrollTop || a.clientY || a.pageY || a.y;
mouseY = parseInt(Y);
dragObjects[action_obj].style.top = mouseY - offsetY - 5 + document.body.scrollTop+"px";
dragObjects[action_obj].style.zIndex = 2;
for (a = 0; a < dragObjects.length; a++) if (a != action_obj) {
var c = dragObjects[action_obj].offsetTop + dragObjects[action_obj].height / 2,
b = dragObjects[a].start + dragObjects[a].height / 2,
d = dragObjects[a].offsetTop + dragObjects[a].height / 2;
if (c > d && b > dragObjects[action_obj].start) {
dragObjects[a].style.top = dragObjects[a].start - dragObjects[action_obj].height+"px";
distance += dragObjects[a].height
} else if (c < d && b < dragObjects[action_obj].start) {
dragObjects[a].style.top = dragObjects[a].start + dragObjects[action_obj].height+"px";
distance -= dragObjects[a].height
} else dragObjects[a].style.top = dragObjects[a].start+"px"
}
}
return false
}
function OnMouseUp() {
dragObjects[action_obj].style.top = dragObjects[action_obj].start + distance+"px";
dragObjects[action_obj].style.zIndex = 1;
save();
DRAG = false
}
function save() {
for (var a = [], c = "", b = 0; b < dragObjects.length; b++) a[b] = Array(dragObjects[b].id, dragObjects[b].offsetTop);
a.sort(function (d, e) {
return d[1] > e[1] ? 1 : d[1] < e[1] ? -1 : 0
});
for (b = 0; b < dragObjects.length; b++) c += a[b][0] + "|";
document.getElementById("save").value = c
};
</script>
</head>
<body>
<div id="drag">
<div id="div1">
div1
</div>
<div style="height:50px" id="div2">
div2
</div>
<div id="div3">
div3
</div>
<div id="div4">
div4
</div>
</div>
<form>
<input style="position:absolute;top:10px;left:300px" id="save" value="result">
</form>
</body>
</html>