js Event Test
<!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>无标题文档</title>
</head>

<body>
<input id="test2" value="test2"/>
<script>
function attClick()//handler of click event
{
alert('hello');
}

function attClick2()//handler of click event
{
alert('hello2');
}

var test2 = document.getElementById('test2');

if(test2.addEventListener){
  test2.addEventListener("click",attClick,false);
  test2.addEventListener("click",attClick2,false);
}else{
  test2.attachEvent("onclick",attClick,false);
  test2.attachEvent("onclick",attClick2,false);
}


function checkNum(e){
   if(e.value=="")return;
   /^([0-9]*)/.exec(e.value);
  
   if(e.value!=RegExp.$1)e.value = RegExp.$1;
}
</script>

<input type="text" name="x" onkeyup="checkNum(this)"/>




<div id="ice" class="dropDiv" style="border: 1px solid rgb(1, 69, 149); left: 911.5px; top: 39px; width: 193px; display: block;">
<div class="list " onMouseOver="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#dddddd'" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#dddddd'" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#dddddd'" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#dddddd'" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#dddddd'" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#dddddd'" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#dddddd'" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#dddddd'" ><div class="word">一只苍蝇的激情四射</div></div>
<div class="list " onMouseOver="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#dddddd'" ><div class="word">一只苍蝇的激情四射</div></div>
</div>


//元字符
<script>
   var strXml = "<author>jack</author>";
   var regExp = /<author>(\w*)<\/author>/;
   regExp.exec(strXml);
   var author = RegExp.$1;
   //alert(author);
  
   function stripTags(s){
   return s.replace(/<\/?[^>]+>/gi,'');
   }
  
   var str = stripTags("<author>jack</author>");
   //alert(str);
  
   function hello(){
   alert("hello");
   }
   window.setTimeout(hello,1000);
   /*document.onclick = function(){
   window.clearTimeout(id);
   }*/
</script>





</body>
</html>
lunzi   2010-10-10 16:30:06 评论:0   阅读:638   引用:0

发表评论>>

署名发表(评论可管理,不必输入下面的姓名)

姓名:

主题:

内容: 最少15个,最长1000个字符

验证码: (如不清楚,请刷新)

Copyright@2004-2010 powered by YuLog