判断控件的length是否为0多好啊?

解决方案 »

  1.   

    编程习惯:循环语句中,不管代码是一行也好,多行也好,请加上大括号{}switch (class_id) { 
      case "1" : 
      {
        if (document.getElementById("list_jia").value == "") {
           alert("请选择一个价格区间"); 
           document.form1.list_jia.focus(); 
        }
        return false; 
      }
      case "2" : 
      {
        if (window.document.form1.test3.value == "") {
           alert("请选择一个test3"); 
           document.form1.test3.focus(); 
        }
        return false; 
      }
      default : 
        alert("ok"); 
    }
    还有:楼主也有忘记语句最后加分号的坏习惯哦。