Javascriptѧϰ±Ê¼ÇÒ» ¶ÔÏó
¼ìË÷:
1 ÓÃ||À´Ìî³äĬÈÏÖµ
var status = flight.status || "unknown";
2 ʹÓÃ&&·ÀÖ¹TypeError
flight.equipment.model //throw "TypeError"
flight.equipment && flight.equipment.model //undefined
ÒýÓÃ
var a={},b={},c={};
document.writeln(a===b); //false
ÔÐÍ
JavascriptÌṩµÄʵÏÖ»úÖÆ£º
var stooge = {
"first-name":"Jerome",
"last-name":"Howard"
};
var temp = function(){};
temp.prototype=stooge;
var another_stooge= new temp;
¿ÉÒÔÖ±½Ó¸øObject¼Ó¸ö·½·¨À´¼ò»¯
if (typeof Object.beget !== 'function'){
Object.beget = function (o){
var F = function (){};
F.prototype = o;
return new F();
}
}
var another_stooge =Object.beget(stooge);
another_stooge["first-name"] = 'Harry';
document.writeln(another_stooge["first-name"]); //Harry
document.writeln(another_stooge["last-name"]); //Howard
document.writeln(stooge["first-name"]); //Jerome
·´Éä
typeof¿ÉÒÔ·ÃÎÊÔÐÍÁ´
document.writeln(typeof flight.toString); //function
hasOwnPropertyÔò²»ÐÐ
document.writeln(flight.hasOwnProperty('toString')); //false
ö¾Ù
ʹÓÃfor inö¾ÙÊôÐÔ µÄ˳ÐòÊDz»È·¶¨µÄ£¬¶øÇÒÐèҪʹÓÃhasOwnProperty£¬²¢Ê¹ÓÃtypeofÅųýº¯Êý
×îºÃ
var properties = [
"first-name",
"last-name"
];
for (var i = 0; i < properties.length; i+=1){
document.writeln(properties[i] + ": " + stooge[properties[i]]);
}
ɾ³ý
ɾ³ý²»»á´¥¼°ÔÐÍÁ´£¬É¾³ý¶ÔÏóÊôÐÔ£¬ÔÐÍÁ´µÄÊôÐÔ¸¡ÏÖ³öÀ´
anothet_stooge["first-name"] = "Jack";
document.writeln(anothet_stooge["first-name"]);//Jack
delete anothet_stooge["first-name"];
document.writeln(anothet_stooge["first-name"]);//Jerome
ÃüÃû¿Õ¼ä
var MYAPP= {}£»
MYAPP.stooge = {
//...
};
Ïà¹ØÎĵµ£º
JavaScript²»Çø·Öµ¥¸ö×Ö·ûºÍ×Ö·û´®£¬ÈκÎ×Ö·û»ò×Ö·û´®¿ÉÒÔÓÃË«ÒýºÅ»òµ¥ÒýºÅÒýÆðÀ´¡£Èç¹û×Ö·û´®±¾Éíº¬ÓÐË«ÒýºÅ£¬ÔòӦʹÓõ¥ÒýºÅ½«×Ö·û´®À¨ÆðÀ´£»Èç¹û×Ö·û´®±¾Éíº¬Óе¥ÒýºÅ£¬ÔòӦʹÓÃË«ÒýºÅ½«×Ö·û´®ÒýÆðÀ´£¬Á½Õß¿ÉÒÔǶÌ×ʹÓᣠ......
½ñÌìÔÚѧϰBomʱÓöµ½ÁËÒ»¸ö´íÎó£º
Static overflow at 7
´íÎóÔÒò£º×Ô¶¨ÒåÁËÒ»¸ö scrollTo()£¬Óëϵͳwindow.scrollTo()³åÍ»£¬ÒÔÖÂÒýÆðËÀÑ»·£¬´Ë´íÎóÔÚµ¯³ö´íÎó¿ò£¬¶øÔÚFFÏÂûÓз´Ó¦£¬µ«functionÒ²²»Ö´ÐС£ÁíÍâ<img src="" onerror=""/>Ò²¿ÉÄܳöÏÖÕâÖÖÇé¿ö¡£ÏêϸÇë²Î¿¼£ºhttp://www.cnblogs.com/S.Sams/archive/200 ......
Ò»¡¢deleteÔËËã·ûɾ³ý¶ÔÒÔǰ¶¨ÒåµÄ¶ÔÏóÊôÐÔ»ò·½·¨µÄÒýÓãº
var o=new Object();
o.name="hello";
alert(o.name); //Êä³ö“hello”
delete o.name£»
alert(o.name); //Êä³ö& ......
jsÈçºÎʵÏÖÔÚÒ³ÃæÍêÈ«¼ÓÔØºóÖ´ÐÐjavascriptº¯Êý»ò/´úÂëÄØ?
¿ÉÒÔÊÇÒÔϼ¸ÖÖ
<body onload="function name()" > </body >
<script >window.onload=function name </script >
<script language="javascript" for="window" event="onload" >function name(); </script >
µ ......
×ªÔØ×Ô£ºhttp://www.ruanyifeng.com/blog/2009/09/find_element_s_position_using_javascript.html
Áíһƪ£ºhttp://blog.csdn.net/ivan820819/archive/2009/09/03/4515122.aspx
ÖÆ
×÷
ÍøÒ³µÄ¹ý³ÌÖУ¬ÄãÓÐʱºòÐèÒªÖªµÀij¸öÔªËØÔÚÍøÒ³ÉϵÄÈ·ÇÐλÖá£
ÏÂÃæµÄ½Ì³Ì×ܽáÁËJavascriptÔÚÍøÒ³¶¨Î»·½ÃæµÄÏà¹ØÖª
ʶ¡£
Ò»¡¢ÍøÒ³µ ......