73 lines
1.3 KiB
PHP
73 lines
1.3 KiB
PHP
<style>
|
|
<!--.drag{position:relative;cursor:hand}
|
|
-->
|
|
</style>
|
|
|
|
<script language="JavaScript">
|
|
var dragapproved=false
|
|
var z,x,y
|
|
var browser = navigator.appName; //find the browser name
|
|
if(browser == "Microsoft Internet Explorer"){
|
|
IE=1
|
|
}else{
|
|
IE=0
|
|
}
|
|
|
|
//alert(IE)
|
|
function move(){
|
|
|
|
if (event.button==1&&dragapproved){
|
|
z.style.pixelLeft=temp1+event.clientX-x
|
|
z.style.pixelTop=temp2+event.clientY-y
|
|
return false
|
|
}
|
|
}
|
|
function drags(){
|
|
//if (!document.all)
|
|
// return
|
|
|
|
dragapproved=true
|
|
if(IE){
|
|
z=event.srcElement
|
|
alert(z)
|
|
}else{
|
|
var node=this.parentNode;
|
|
//node=node.parentNode;
|
|
alert(node.id);
|
|
//alert(node.nodeType);
|
|
//alert(node.id);
|
|
|
|
|
|
//while(node.nodeType!=1){
|
|
// alert('11')
|
|
// node=node.parentNode;
|
|
//}
|
|
//alert('22')
|
|
//alert(node);
|
|
|
|
|
|
}
|
|
|
|
while (z.id.indexOf("statusLed") == -1) {//check the z if it's led
|
|
z = z.parentElement;
|
|
if (z == null) {
|
|
return true;
|
|
}
|
|
}
|
|
temp1=z.style.pixelLeft
|
|
temp2=z.style.pixelTop
|
|
x=event.clientX
|
|
y=event.clientY
|
|
document.onmousemove=move
|
|
}
|
|
function dropDrags() {
|
|
dragapproved=false
|
|
window.location.href='./mapStatus.php?command=save&drag_x='+z.style.pixelLeft+"&drag_y="+z.style.pixelTop+"&drag_key_led_num="+z.id
|
|
z = null;
|
|
return true
|
|
}
|
|
document.onmousedown=drags
|
|
document.onmouseup=dropDrags
|
|
</script>
|
|
|