//平常的一些效验
var foo = function(arg) {
if (!arg) {
alert("normal false");
} else { alert("true"); }
}
foo(null); //false
foo(false); //false
foo(""); //false
foo("never-online"); //true
//全等效验
var foo = function(arg) {
if (arg===false) {
alert("false");
} else { alert("not a false variable") }
}
foo(null); //not a false variable
foo(false); //false
foo(""); //not a false variable
foo("never-online"); //not a false variable
<script>
var location='never-online';
</script>
<script type="text/javascript">
//<![CDATA[
myVar = "never-online";
(function () {
//var myVar;
alert(myVar)
})()
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
alert(location);
//var location;
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
var p = document.createElement("IMG");
p.src="."; alert(p.src);
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
var isSupportedXMLHttp = !!new ActiveXObject("MSXML2.XMLHTTP");
alert(isSupportedXMLHttp)
//]]>
</script>
/*@cc_on
document.write("JScript 版本: " + @_jscript_version + ".<br>");
/*@if (@_jscript_version >= 5)
document.write("JScript 版本 5.0+.<br \/>");
document.write("只有当浏览器支持JScript5+的时候你才能看到这些文字.<br>");
@else @*/
document.write("当你使用其他浏览器(比如: Firefox, IE 4.x 之类)的时候看到这行文字<br>");
/*@end
@*/