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

javascript Ö® prototype

function MyObject1(formalParameter){
    alert("MyObject1");    
    this.testNumber = formalParameter;
    //1
    this.toString= function(){
       alert("MyObject1:"+this.testNumber);
    };    
}
function MyObject2(formalParameter){
    alert("MyObject2");   
    this.testString = formalParameter;
    //2
    this.toString= function(){
       alert("MyObject2:"+this.testString);
    };    
}
MyObject2.prototype = new MyObject1( 8 );
var objectRef = new MyObject2( "String_Value" );
alert(objectRef);
½á¹ûΪ
MyObject1
MyObject2
String_Value
undefined(Ϊʲô»á³öÏÖ£¿)
×¢ÊÍ2ÒÔϽá¹ûΪ8
×¢ÊÍ1ºÍ2ÒÔϽá¹ûΪ[object Object]
alert(MyObject2);  µ÷ÓÃÁËFunction.prototype.toString
var ....=(function() {return .....})();   Èç¹ûûÓÐreturn£¬()()¾ÍûÓбØÒª
£¨£©£¨£©·µ»ØÖ´ÐеĽá¹û
²Î¿¼ÎÄÕ http://www.cn-cuckoo.com/wordpress/wp-content/uploads/2007/08/JavaScriptClosures.html


Ïà¹ØÎĵµ£º

CºÍPython³ÌÐòÔ±µÄJavaScriptѧϰָÄÏ£¨Ò룩


write by ¾ÅÌìÑãôá(JTianLing) -- blog.csdn.net/vagrxie
ÌÖÂÛÐÂÎÅ×é¼°Îļþ
 Ô­ÎÄÀ´×Ô£º¡¶JavaScript for C & Python programmers
¡·£¬¾­¹ý×÷ÕßCanisÔÊÐíºó·­Ò룬¼´Ê¹×ªÔØÇ븽´ø´ËÁ´½Ó¡£

Ç°ÑÔ£ººÜÉٸɷ­ÒëµÄÊÂÇ飬ÀÛ£¬ÐÁ¿à£¬²»ÄÜ·¢»Ó£¬µäÐ͵ķÑÁ¦²»Ìֺã¬×î½üÎÞÁÄ£¬ÏëÔÚÍøÒ³ÉÏÏÔʾ¶¯»­£¨ÒòΪCSDNÌ ......

³£ÓõÄJavaScriptÑéÖ¤ÕýÔò±í´ïʽ

³£ÓõÄJavaScriptÑéÖ¤ÕýÔò±í´ïʽ
ÏÂÃ涼ÊÇÎÒÊÕ¼¯µÄһЩ±È½Ï³£ÓõÄÕýÔò±í´ïʽ£¬ÒòΪƽ³£¿ÉÄÜÔÚ±íµ¥ÑéÖ¤µÄʱºò£¬Óõ½µÄ±È½Ï¶à¡£ÌØ·¢³öÀ´£¬Èø÷λÅóÓѹ²Í¬Ê¹Ó᣺Ǻǡ£
Æ¥ÅäÖÐÎÄ×Ö·ûµÄÕýÔò±í´ïʽ£º [u4e00-u9fa5]
ÆÀ×¢£ºÆ¥ÅäÖÐÎÄ»¹ÕæÊǸöÍ·ÌÛµÄÊ£¬ÓÐÁËÕâ¸ö±í´ïʽ¾ÍºÃ°ìÁË
Æ¥ÅäË«×Ö½Ú×Ö·û(°üÀ¨ºº×ÖÔÚÄÚ)£º[^x00-xff]
ÆÀ×¢ ......

javascript£º»ñÈ¡ÆÁÄ»¸ß¶ÈºÍ¿í¶ÈµÈÐÅÏ¢

ÍøÒ³¿É¼ûÇøÓò¿í£º document.body.clientWidth
ÍøÒ³¿É¼ûÇøÓò¸ß£º document.body.clientHeight
ÍøÒ³¿É¼ûÇøÓò¿í£º document.body.offsetWidth (°üÀ¨±ßÏߵĿí)
ÍøÒ³¿É¼ûÇøÓò¸ß£º document.body.offsetHeight (°üÀ¨±ßÏߵĸß)
ÍøÒ³ÕýÎÄÈ«ÎÄ¿í£º document.body.scrollWidth
ÍøÒ³ÕýÎÄÈ«Îĸߣº document.body.scrollHeight ......

javascript ±Õ°ü

¡¾×ª¡¿http://www.cnblogs.com/chenxizhang/archive/2010/01/02/1638010.html
±¾ÎÄתÔØ×Ô£ºhttp://www.cn-cuckoo.com/2007/08/01/understand-javascript-closures-72.html
Òª³ÉΪ¸ß¼¶ JavaScript ³ÌÐòÔ±£¬¾Í±ØÐëÀí½â±Õ°ü¡£
±¾ÎĽáºÏ ECMA 262 ¹æ·¶Ïê½âÁ˱հüµÄÄÚ²¿¹¤×÷»úÖÆ£¬Èà JavaScript ±à³ÌÈËÔ±¶Ô±Õ°üµÄÀí½â´Ó&ldquo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ