javascript typeof应用
typeof 是JavaScript的运算符
——返回一个用来表示表达式的数据类型的字符串
typeof[(] expression [)] //typeof语法中的圆括号是可选项
typeof 运算符@import url(../html-vss/msdnie4a.css);
typeof
运算符把类型信息当作字符串返回。typeof
返回值有六种可能: "number," "string,"
"boolean," "object," "function," 和 "undefined."
实例<html>
<head>
<title>typeof测试用例页面</title>
<mce:script type="text/javascript"><!--
t = function(i) {
alert(typeof 123);//number
alert(typeof("123"));//String
}
// --></mce:script>
<mce:style type="text/css"><!--
div {
opacity: 0.5;
}
--></mce:style><style type="text/css" mce_bogus="1"> div {
opacity: 0.5;
}
</style>
</head>
<body>
<div onclick="t(1)">测试typeof</div>
</body>
</html>
相关文档:
Identifier Resolution Performance 标识符识别性能
Identifier resolution isn't free, as in fact no computer operation really is without some sort of performance overhead. The deeper into the execution context's scope chain an identifier exists, the slower it is to access for ......
Dynamic Scopes 动态作用域
Both the with statement and the catch clause of a try-catch statement, as well as a function containing eval_r(), are all considered to be dynamic scopes. A dynamic scope is one that exists only through execution of code and therefore cannot be det ......
<script>
//写cookies函数 作者:翟振凯
function
SetCookie(name,value)//两个参数,一个是cookie的名子,一个是值
{
var Days = 30;
//此 cookie 将被保存 30 天
var exp = new Date(); //new
Date("December 31, 9998");
  ......
var
xmlDoc
=
null
;
function
parseXML
(
xmlUrl
)
{
try
{
//IE
xmlDoc
=
new
ActiveXObject
(
"Microsoft.XMLDOM"
);
xmlDoc
.
async
=
false
;
xmlDoc
......