js中判断数据类型的方法 typeof
<input type="text" onblur="demo(this)"/><br/>
<input type="number" onblur="demo(this)" /><br/>
<script>
function demo(obj){
alert(obj.value+" 数据类型是 "+typeof(obj.value));
alert("str"+" 数据类型是 "+typeof("str"));
alert(111+" 数据类型是 "+typeof(111));
}
</script>

浙公网安备 33010602011771号