码迷,mamicode.com
首页 > Web开发 > 详细

js中判断数据类型的方法 typeof

时间:2017-06-25 18:40:10      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:value   判断   htm   数据类型   alert   div   str   type   cti   

  <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>
  

  

js中判断数据类型的方法 typeof

标签:value   判断   htm   数据类型   alert   div   str   type   cti   

原文地址:http://www.cnblogs.com/1020182600HENG/p/7077274.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!