Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascriptÅжϱäÁ¿ÀàÐ͵Ä×Ô¶¨Ò庯Êý

ͨ³£ÓÃtypeofÀ´ÅжÏjs±äÁ¿µÄÀàÐÍ£¬µ«ºÜ¶àʱºò½ö½ötypeofÂú×ã²»ÁËÒªÇóµÄ¡£
ÎÒдÁËÒ»¸ö×Ô¶¨Ò庯ÊýÀ´×öÕâ¸öÊ£¬ÅжϵıȽÏÈ«ÃæÁË¡£
New
function
varType(v){

  if
(
typeof
v===
"object"
){

    if
(v===
null
)
return
'null'
;

    if
(v.
constructor
)

      return
(v.
constructor
.toString()).match(/(?:
)[\w\$]+/)[
0
];

    if
(
typeof
typeof2===
'undefined'
&&
window
.execScript){

     
window
.execScript(
'Function vbsTypeName(o):vbsTypeName=TypeName(o):End
Function'
,
'vbscript'
);

      window
.execScript(
'function typeof2(o){return vbsTypeName(o)}'
,
'jscript'
);

    }

    if
(
typeof
typeof2!==
'undefined'
){

      return
typeof2(v);

    }

    return
"object"
;

  }

  return typeof
v;

}

//¶ÔÓÚÆÕͨjs³£Á¿ºÍjs¶ÔÏ󣬸÷ä¯ÀÀÆ÷ÊÇ»ù±¾Ò»ÖµÄ

alert
(varType());
//undefined

alert
(varType(
100
));
//number

alert
(varType({}));
//Object

alert
(varType([]));
//Array

alert
(varType(/ /));
//RegExp

alert
(varType(
new
Date
()));
//Date

alert
(varType(
Date
));
//function

alert
(varType(
Object
));
//function

alert
(varType(
RegExp
));
//function

//¶ÔÓÚDOM¶ÔÏ󣬸÷ä¯ÀÀÆ÷¿ÉÄÜ»áÓв»Í¬Öµ

alert
(varType(
window
));
//IE:HTMLWindow2 FF:Window

alert
(varType(
document
));
//IE:HTMLDocument FF:HTMLDocument

alert
(varType(
document
.body));
//IE:HTMLBody FF:HTMLBodyElement

alert
(varType(
Option
));
//IE:Object  FF:function

alert
(varType(
Image
));
//IE:Object  FF:function

alert
(varType(
navigator
));
//IE:DispHTMLNavigator FF:Navigator

//ÒÔϼ¸¸öÖ»ÊÊÓÃÓÚIE£¬ÆäËûÄÚºËä¯ÀÀÆ÷²»Ö§³Ö

alert
(varType(
ActiveXObject
));
//IE:function

alert
(varType(


Ïà¹ØÎĵµ£º

javascript framework£¬ JS³£Óú¯Êý£¨·½·¨£©£¬jQuery

//Register NameSpace for window.MSN
if(!window.MSN)
{
    window.MSN = {};
}
if(!window.MSN.SET)
{
    window.MSN.SET = {};
}
if(!window.MSN.SET.Utilities)
{
    window.MSN.Utilities = {};
}
//Check you borwse type
//IE7 &IE8 & FF et ......

JavaScriptÄ£¿éËæÒâÍ϶¯

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>JavaScriptÄ£¿éË ......

´«ÖDz¥¿ÍJavaѧϰ JavaScript¼ÓÇ¿

ÎÒ½ñÌìѧϰÁËÙ¡ÀÏʦ½²µÄJavaScript½âÎöDomÎĵµµÄ֪ʶ£º
Ò»¡¢        ½Úµã·ÖΪ3ÖÖÀàÐÍ£¬ÔªËؽڵ㣬ÊôÐԽڵ㣬Îı¾½Úµã
¶þ¡¢        ²éÕҽڵ㣺
l       js´úÂë²»ÄÜдÔÚbodyÔªËØµÄÇ°Ãæ£¬js ´úÂëдÔÚ <head> ½ ......

javascript ³£ÓõÄ55¸ö¼¼ÇÉ

1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡Ïûѡȡ¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return false;" oncut="return f ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ