Set class in JS:
Document. getelementbyid ("divid"). classname = "mydivclass ";
Link:
Addeventhandler (this. Drag, "mousedown", bindaseventlistener (this, this. Start ));
Http://www.cnblogs.com/cloudgamer/archive/2008/11/17/Drag.html
Http://www.cnblogs.com/dolphinX/archive/2012/10/13/2722501.html
Http://www.cnblogs.com/shiyangxt/archive/2008/11/16/1382433.htmlfilter
Div drag
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<style type="text/css">
#main div{position:absolute;width:220px;height:150px;border:1px solid #999;}
</style>
<script type="text/javascript">
var a;
document.onmouseup=function(){if(!a)return;document.all?a.releaseCapture():window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);a="";};
document.onmousemove=function (d){if(!a)return;if(!d)d=event;a.style.left=(d.clientX-b)+"px";a.style.top=(d.clientY-c)+"px";};
function $(o,e){a=o;document.all?a.setCapture():window.captureEvents(Event.MOUSEMOVE);b=e.clientX-parseInt(a.style.left);c=e.clientY-parseInt(a.style.top);}
</script>
<body>
<div id="main">
<div onmousedown="$(this,event)">1</div>
<div onmousedown="$(this,event)">2</div>
<div onmousedown="$(this,event)">3</div>
<div onmousedown="$(this,event)">4</div>
<div onmousedown="$(this,event)">5</div>
<div onmousedown="$(this,event)">6</div>
</div>
</body>
Determine which control gets focus
Function isactive (ID ){
VaR OBJ = Document. activeelement;
If (OBJ = NULL) return false;
Return obj. ID = ID;
}
Determine the Focal Point
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Div + CSS Example, Wayhome‘s Blog</title>
<body onkeyup="test(event)">
<input type="text" id="shuru1">
<input type="text" id="shuru2">
<input type="text" id="shuru3">
<script> var myInput = document.getElementsByTagName(‘input‘);
function test(event){
for(var i=0;i<myInput.length;i++){
if (myInput[i] == document.activeElement) {
te=myInput[i];
}
}
if (te == document.activeElement) {
} else {
if(70==event.keyCode){
Alert ("shortcut key ");
}
}
}
</script>
</body>
<div id="zshuju">dfa</div>
<Input type = "button" onclick = "javascript: Alert (document. getelementbyid ('zshuju'). style. zindex)" value = "pop-up"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Div + CSS Example, Wayhome‘s Blog</title>
<body onkeyup="test(event)">
<input type="text" id="shuru">
<script>
function test(event){
for(var i=0;i<myInput.length;i++){
if (myInput[i] == document.activeElement) {
te=myInput[i];
}
}
if (te == document.activeElement) {
} else {
if(70==event.keyCode){
Alert ("shortcut key ");
}
}
}
</script>
</body>
Gains in September 1