Gains in September 1

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.