在javascript中经常用到数组如:多个名字相同的checkbox,若是动态生成的,提交时就需要判断其是否是数组
(document.mylist.lenght!="undefined"){}这个是错误的用法
正确的是if(typeof(document.mylist.length!="undefined")){}
或if(!isNaN(document.mylist.lenght){}
typeof的运算数未定义,返回的就是"undefined"
typeof运算符用来返回一个用来表示表达式的数据类型的字符串
typeof(x)得到->"number"; //运算数为数字 例:alert(typeof(123)); //返回"number"
typeof(x)得到->"string"; //字符串 例:alert(typeof("123")); //返回"string"
typeof(x)得到->"boolean"; //布尔值
typeof(x)得到->"object"; //对象,数组和null
typeof(x)得到->"function" //函数
typeof(x)得到->"undefine"; //x未定义