码迷,mamicode.com
首页 > 其他好文 > 详细

9月1日收获

时间:2014-09-01 22:24:23      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   io   java   ar   for   

js中设置class:

document.getElementById("divID").className="mydivclass";

 

 

 链接:

addEventHandler(this.Drag, "mousedown", BindAsEventListener(thisthis.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/1334633.html滤镜

 

 div拖动

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<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>
</head>
<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>
</html>

判断哪控件获得焦点
function isActive(id){
        var obj=document.activeElement;
        if (obj==null) return false;
        return obj.id==id;
}








判断那个获得焦点
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Div + CSS Example, Wayhome‘s Blog</title>

</head>
<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("快捷键");

                	}
             }
  				}
</script>
</body>
</html>
<div  id="zshuju">dfa</div>
<input type="button" onclick="javascript:alert(document.getElementById(‘zshuju‘).style.zIndex)" value="弹出"/> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  


<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>Div + CSS Example, Wayhome‘s Blog</title>
</head>
<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("快捷键");

                	}
             }
  				}
</script>
</body>
</html>

9月1日收获

标签:style   blog   http   color   os   io   java   ar   for   

原文地址:http://www.cnblogs.com/lixinyuan1213/p/3950134.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!