js出错总结

1 没有</script>
  src="js" "./js" "../js"
2 dom对象与jquery对象(jquery对象其实是集合,每个对象都有innerHTML 即html())
  $("#dd") != document.getElementById("dd")
  $("#dd")[0]= document.getElementById("dd")
  $("#dd") = $(document.getElementById("dd"))
   v=$(v)[0]

 下面的几种写法对的
 $("#dd").html(); $("#dd")[0].innerHTML;$("#dd").eq(0)[0].innerHTML;$("#dd").get(0).innerHTML;

3 eval() string转换为正则表达式

4 改菜单栏

<body>
<script>changeTitleActive(5);</script>
<script type="text/javascript">
function changeTitleActive(_value){
    for(var i=1;i<7;i++){
            if(_value==i){
                $("#title"+i).attr("class","dropdown active");
            }else{
                $("#title"+i).attr("class","dropdown");
            }
            
        
    }
    
}
</script>

5检查名字的唯一性
function checkIsHave(avalues){
  document.getElementById("showPrompt").innerHTML="正在验证...";
 document.getElementById("showPrompt").style.color="red";
 checkIsOkPublic("ims_interviewer","username",avalues,"showPrompt"); 
 } 

jsp:
onblur="checkIsHave(this.value);"maxlength="15";
<font id="showPrompt" ></font>

6 var reg=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/; if(!reg.test(usermail)){}

7var now = new Date();
now.setHours(0, 0, 0, 0);
console.log(now.getTime());

posted @ 2013-08-02 16:14  墙头一颗草  Views(154)  Comments(0Edit  收藏  举报