首页 »Javascript教程 » javascripttypeof:Javascript typeof 使用方法 »正文javascripttypeof:Javascript typeof 使用方法来源: 发布时间:星期一, 2008年12月29日 浏览:2次 评论:0
(document.mylist.length != "und" ) {} 这个使用方法有误.
正确是 ( typeof(document.mylist.length) != "und" ) {} 或 ( !isNaN(document.mylist.length) ) {} typeof运算数未定义,返回就是 "und". 运算数为数字 typeof(x) = "number" 串 typeof(x) = "" 布尔值 typeof(x) = "boolean" 对象,和null typeof(x) = "object" typeof(x) = "function" typeof 运算符返回个用来表示表达式数据类型串 可能串有:"number"、""、"boolean"、"object"、"function" 和 "und" 如: alert(typeof (123));//typeof(123)返回"number" alert(typeof ("123"));//typeof("123")返回"" typeof 运算符 返回个用来表示表达式数据类型串 typeof[expression] ; expression 参数是需要查找类型信息任意表达式 脚本的家 www.jb51.net 更多javascript资料可以访问 介绍说明 typeof 运算符把类型信息当作串返回typeof 返回值有 6种可能: "number," "," "boolean," "object," "function," 和 "und." typeof 语法中圆括号是可选项 0
相关文章
读者评论
发表评论 |