易截截图软件、单文件、免安装、纯绿色、仅160KB

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>


相关文档:

[翻译]High Performance JavaScript(006)

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

[翻译]High Performance JavaScript(007)

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

javascript cookies 存、取、删除实例

<script>
//写cookies函数 作者:翟振凯
function
SetCookie(name,value)//两个参数,一个是cookie的名子,一个是值
{
    var Days = 30;
//此 cookie 将被保存 30 天
    var exp  = new Date();    //new
Date("December 31, 9998");
    ......

javascript跨浏览器创建XML对象


var
 
xmlDoc
 
=
 
null
;
function
 
parseXML
(
xmlUrl
)
{
  try
 
{
    //IE
    xmlDoc
 
=
 
new
 
ActiveXObject
(
"Microsoft.XMLDOM"
);
    xmlDoc
.
async
 
=
 
false
;
    xmlDoc ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号