typeof(var)是用来判断变量是否为数组的。
JS中经常需要操作HTML控件,大家知道,HTML空间如果名字都取相同的话,
那么使用document.getElementsByName就可以取得一个数组。
如果想使用if(document.aaa.length!="undefined")来判断名字为"aaa"的
控件在页面中是否存在多个(也就是数组)的话,这个用法就会报错。
这时就要使用if(typeof(document.aaa.length) !== 'undefined')。
详细解决方案
JS中typeof() !== 'undefined'的意义
热度:134 发布时间:2012-10-20 14:12:48.0
相关解决方案
- Expression dqgrade is undefined on line 20, column 30-freemarker报这样的错如何解决
- 初学者发问:The constructor Printwriter(String) is undefined
- flash 读取 servlet 生成的xml 展示 undefined
- mvc过去台发送ajax请求得到的数据显示未定义(undefined),哪位帮忙看看
- 在线请问调用Jquery异常:TypeError: a is undefined 的异常原因有哪些
- 'undefined'为空或不是对象,该怎么解决
- c#中的 typeof 是什么意思?解决方法
- Undefined symbol: '_CxxFrameHandler'?该如何解决
- undefined reference to异常怎么解决
- MTK Undefined symbol Image$$ZI$$Limit (referred from sys_stackheap.o) 怎么解决
- MTK平台链接异常:Undefined symbol Image$$ZI$$Limit
- CCS编译X264 ERROR string.h error:identifier "using" is undefined,该如何处理
- Processor ARM79_0 raised an exception.Cause: Undefined instruction,该如何处理
- Ada程序编译不过 提醒 Other is undefined
- : error A2006: undefined symbol : data解决办法
- apache配置httpd.conf异常 undefined symbol: ap_proxy_ftp_canon
- undefined reference to `av_register_all'这样的异常如何解决呀
- undefined reference to `av_register_all'这样的异常如何解决呀
- thinkphp 有关问题 Call to undefined function
- :缺少对象: '[undefined]',如何解决?
- 输出出现未定义变量提醒:Notice: Undefined variable: str in
- 报错Notice: Undefined offset: 一
- 求问下这个 Call to undefined function int()的缘故
- Fatal error: Call to undefined function curl_init()怎么解决
- 登录后台老板报错Fatal error: Call to undefined function _phpForKoXHbKBqn6BHxAmysql()
- php “Call to undefined function: mb_substr()”的解决办法
- 。call to undefined function ImageCreate() in phpqrcode.php on line 985
- Fatal error: Call to undefined function curl_init(),该怎么解决
- php老提示 Undefined variable: 的解决方法
- 施用数组元素出现Notice: Undefined offset