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

JavaScript µÄ¼Ì³Ð»úÖÆ

      ¼Ì³Ð»úÖÆ£¬Ëµµ½¼Ì³Ð£¬¾ÍÒªÏëµ½´Ó»ùÀ࿪ʼ£¬µ«ÊÇJavaScriptÖеÄÀàÓÐÁ½´óÀࣺһ£¬ÄÚǶµÄ£»¶þ£¬Óû§×Ô¶¨Ò壻һ°ãÇ°Õß²»»á±»ÓÃÀ´×ö»ùÀ࣬ԭÒòÊÇΪÁ˱£ÕÏjsµÄ°²È«¡£µ«ÊÇÎÒÃÇ¿ÉÒÔͨ¹ýprototypeÀ´¶Ô»ùÀà½øÐÐÀ©³ä£¬Ôö¼ÓÎÒÃÇÏëÒªµÄÊôÐԺͷ½·¨¡£ÒÔÏÂÊÇ×Ô¼º¶Ô¼Ì³ÐµÄ¼¸ÖÖ·½Ê½µÄÀí½â¡£
1>  ¶ÔÏóð³ä£¬ÊÇJavaScript ºÍ ECMAScriptʵÏּ̳еķ½·¨£¬ÔÚѧϰ¶ÔÏóð³äʵÏּ̳ÐÇ°ÎÒÃǵÄÏÈÁ˽â¹Ø¼ü×Ö this µÄʹÓã¬ÀýÈ磺
          function classA(color){
this.color = color;
this.show = function(){alert(this.color);}
}
/*
Note:
1> this ´ú±íµÄÊÇclassAº¯ÊýËù¹¹½¨µÄ¶ÔÏ󣬶ø·Çº¯ÊýclassA¶ÔÏó±¾ÉíÕâÑù˵Ö÷ÒªÊÇΪÁ˱ÜÃ⣨function is object£©µÄÓ°Ïì;
2> ÔÚ¹¹½¨classA¶ÔÏóʱ£¬ÊÇͨ¹ýthisÀ´³õʼ»¯µÄÊôÐԺͷ½·¨µÄ£¬Èç¹ûÓÃclassBµÄthisȥð³äclassAµÄthis£¬ÄÇô¾ÍʵÏÖÁ˼òµ¥µÄ¼Ì³ÐÁË
*/
2>¼Ì³Ð»úÖƵÄʵÏÖ·½Ê½£º 
    NO1£º¶ÔÏóð³ä
         ¶ÔÏóð³äµÄÔ­Àí£ºº¯ÊýclassAͨ¹ýthisÀ´³õʼ»¯ÊôÐԺͷ½·¨£¬Èç¹ûÓú¯ÊýclassBµÄthisð³äclassAµÄthisÈ¥Ö´ÐУ¬Ôò¾Í»áʹclassB¾ßÓÐclassAµÄÊôÐԺͷ½·¨¡£ÀýÈç
         function classA(sColor){
this.sColor = sColor;
this.show = function(){alert(this.sColor);}
}
function classB(sColor,sName){
this.new = classA;
this.new(sColor);
delete this.new;
/*
Note
±ØÐëÊÍ·ÅclassAµÄÒýÓã¬ÄÇÑù¶ÔÓÚclassAÊÇ°²È«µÄ¡£¿ÉÊÇÔÙÖ´ÐÐÒ»¶ÎÒÔÉÏ´úÂ룬ʵÏÖ¶àÖؼ̳С£
this.new = classC;
this.new(arguments);
delete this.new;
*/
this.sName = sName;
this.say = function(){alert(this.sName);}
}
var a = new classA("blue");
var b = new classB("red","BMW");
a.show(); // blue
b.say(); //BMW
b.show(); // red
        ×¢Ò⣺¶ÔÏóð³äÊÇËùÓм̳еÄÇ°Ìᣬð³äÖ»ÄÜʹ×ÓÀà¼Ì³Ð»ùÀàÖеÄÊôÐԺͷ½·¨£¬¶Ô»ùÀàprototypeÖеÄÊôÐԺͷ½·¨ÊDz»¿É¼ûµÄ¡£Ò²¿ÉÒÔʵÏÖ¶àÖؼ̳С£
    NO2£ºÔ­ÐÍÁ´
         Ô­ÐÍÁ´£¬ÊǼ̳еÄÁíÒ»ÖÖ·½Ê½


Ïà¹ØÎĵµ£º

107Ìõjavascript³£ÓÃÓï¾ä

1. document.write( " "); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document- >html- >(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window- >(navigator,screen,history,location,document)
5.µÃµ½±íµ¥ÖÐÔªËصÄÃû³ÆºÍÖµ:document.getElementById( "±íµ¥ÖÐÔªËصÄID號 ").name(»òvalu ......

JavascriptÔõôÔÚÁ½¸ö´°ÌåÖ®¼ä´«Öµ

Ô­ÎÄ£ºÁõÎä|JavascriptÔõôÔÚÁ½¸ö´°ÌåÖ®¼ä´«Öµ  
ÖÚËùÖÜÖªwindow.open() º¯Êý¿ÉÒÔÓÃÀ´´ò¿ªÒ»¸öд°¿Ú£¬ÄÇôÈçºÎÔÚ×Ó´°ÌåÖÐÏò¸¸´°Ìå´«ÖµÄØ£¬Æäʵͨ¹ýwindow.opener¼´¿É»ñÈ¡¸¸´°ÌåµÄÒýÓá£
ÈçÎÒÃÇн¨´°ÌåFatherPage.htm:
XML-Code:
<script type="text/javascript">
function OpenChildWindow()
{ ......

JavascriptÔõôÔÚÁ½¸ö´°ÌåÖ®¼ä´«Öµ2

Ô­ÎÄ£ºÁõÎä|JavascriptÔõôÔÚÁ½¸ö´°ÌåÖ®¼ä´«Öµ2-showModalDialog  
ǰһƪÎÄÕÂJavascriptÔõôÔÚÁ½¸ö´°ÌåÖ®¼ä´«ÖµÖн²µ½ÁËÈçºÎÀûÓÃwindow.open()·½·¨´ò¿ªÐ´°Ì壬²¢ÔÚÁ½¸ö´°ÌåÖ®¼ä´«ÖµµÄ·½·¨¡£javascriptÖл¹ÓÐÒ»¸öº¯Êýwindow.showModalDialogÒ²¿ÉÒÔ´ò¿ªÒ»¸öд°Ì壬²»¹ýËû´ò¿ªµÄÊÇÒ»¸öģ̬´°¿Ú£¬ÄÇôÈçºÎÔÚ¸¸´°Ì ......

IEºÍFirefoxÔÚcss,JavaScript·½ÃæµÄ¼æÈÝÐÔ

1.document.formName.item("itemName") ÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃdocument.formName.item("itemName")»òdocument.formName.elements["elementName"];FirefoxÏÂ,Ö»ÄÜʹÓÃdocument.formName.elements["elementName"].
½â¾ö·½·¨:ͳһʹÓÃdocument.formName.elements["elementName"].
2.¼¯ºÏÀà¶ÔÏóÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃ() ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ