JavascriptÔÚIEºÍFireFoxÖеIJ»Í¬±íÏÖ
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ÏÂ,¿ÉÒÔʹÓÃ()»ò[]»ñÈ¡¼¯ºÏÀà¶ÔÏó;FirefoxÏÂ,Ö»ÄÜʹÓÃ[]»ñÈ¡¼¯ºÏÀà¶ÔÏó.
½â¾ö·½·¨:ͳһʹÓÃ[]»ñÈ¡¼¯ºÏÀà¶ÔÏó.
3.×Ô¶¨ÒåÊôÐÔÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓûñÈ¡³£¹æÊôÐԵķ½·¨À´»ñÈ¡×Ô¶¨ÒåÊôÐÔ,Ò²¿ÉÒÔʹÓÃgetAttribute()»ñÈ¡×Ô¶¨ÒåÊôÐÔ;FirefoxÏÂ,Ö»ÄÜʹÓÃgetAttribute()»ñÈ¡×Ô¶¨ÒåÊôÐÔ.
½â¾ö·½·¨:ͳһͨ¹ýgetAttribute()»ñÈ¡×Ô¶¨ÒåÊôÐÔ.
4.eval("idName")ÎÊÌâ
˵Ã÷:IEÏÂ,,¿ÉÒÔʹÓÃeval("idName")»ògetElementById("idName")À´È¡µÃidΪidNameµÄHTML¶ÔÏó;FirefoxÏÂÖ»ÄÜʹÓÃgetElementById("idName")À´È¡µÃidΪidNameµÄHTML¶ÔÏó.
½â¾ö·½·¨:ͳһÓÃgetElementById("idName")À´È¡µÃidΪidNameµÄHTML¶ÔÏó.
5.±äÁ¿ÃûÓëijHTML¶ÔÏóIDÏàͬµÄÎÊÌâ
˵Ã÷:IEÏÂ,HTML¶ÔÏóµÄID¿ÉÒÔ×÷ΪdocumentµÄÏÂÊô¶ÔÏó±äÁ¿ÃûÖ±½ÓʹÓÃ;FirefoxÏÂÔò²»ÄÜ.FirefoxÏÂ,¿ÉÒÔʹÓÃÓëHTML¶ÔÏóIDÏàͬµÄ±äÁ¿Ãû;IEÏÂÔò²»ÄÜ¡£
½â¾ö·½·¨:ʹÓÃdocument.getElementById("idName")´úÌædocument.idName.×îºÃ²»ÒªÈ¡HTML¶ÔÏóIDÏàͬµÄ±äÁ¿Ãû,ÒÔ¼õÉÙ´íÎó;ÔÚÉùÃ÷±äÁ¿Ê±,Ò»ÂɼÓÉÏvar,ÒÔ±ÜÃâÆçÒå.
7.input.typeÊôÐÔÎÊÌâ
˵Ã÷:IEÏÂinput.typeÊôÐÔΪֻ¶Á;µ«ÊÇFirefoxÏÂinput.typeÊôÐÔΪ¶Áд.
9.event.xÓëevent.yÎÊÌâ
˵Ã÷:IEÏÂ,even¶ÔÏóÓÐx,yÊôÐÔ,µ«ÊÇûÓÐpageX,pageYÊôÐÔ;FirefoxÏÂ,even¶ÔÏóÓÐpageX,pageYÊôÐÔ,µ«ÊÇûÓÐx,yÊôÐÔ.
½â¾ö·½·¨:ʹÓÃmX(mX = event.x ? event.x : event.pageX;)À´´úÌæIEϵÄevent.x»òÕßFirefoxϵÄevent.pageX.
10.event.srcElementÎÊÌâ
˵Ã÷:IEÏÂ,event¶ÔÏóÓÐsrcElementÊôÐÔ,µ«ÊÇûÓÐtargetÊôÐÔ;FirefoxÏÂ,event¶ÔÏóÓÐtargetÊôÐÔ,µ«ÊÇûÓÐsrcElementÊôÐÔ.
½â¾ö·½·¨:ʹÓÃobj(obj = event.srcElement ? event.srcElement : event.target;)À´´úÌæIEϵÄevent.srcElement»òÕßFirefoxϵÄevent.target.
13.frameÎÊÌâ
ÒÔÏÂÃæµÄframeΪÀý£º
<frame src="xxx.html" id="frameId" name="frameName" />
Ïà¹ØÎĵµ£º
ÉùÃ÷:Õâ¸öÊÇÍøÉϵÄ×ÊÁÏ,²»¹ýÎÒÔںܴó³Ì¶ÈÉϽøÐÐÁË×Ô¼ºµÄ˵Ã÷½éÉÜ,Ï£Íû´ó¼Ò»áϲ»¶¿´
1.document.write("Êä³öÄÚÈÝ");ΪÊä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪµ¥ÐÐ//ºÍ¶àÐÐ/**/
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document->html->(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window->(navigator,screen,history,location,docume ......
1¡¢Ê²Ã´ÊDZհü¡¢ÒÔ¼°±Õ°üËùÉæ¼°µÄ×÷ÓÃÓòÁ´ÕâÀï¾Í²»ËµÁË¡£
2¡¢JavaScriptÀ¬»ø»ØÊÕ»úÖÆ
JavaScript²»ÐèÒªÊÖ¶¯µØÊÍ·ÅÄڴ棬ËüʹÓÃÒ»ÖÖ×Ô¶¯À¬»ø»ØÊÕ»úÖÆ£¨garbage collection£©¡£µ±Ò»¸ö¶ÔÏóÎÞÓõÄʱºò£¬¼´³ÌÐòÖÐÎÞ±äÁ¿ÒýÓÃÕâ¸ö¶ÔÏóʱ£¬¾Í»á´ÓÄÚ´æÖÐÊͷŵôÕâ¸ö±äÁ¿¡£
Code
&nb ......
×î½üÔÚÍøÉϲéÔÄÁ˲»ÉÙJavascript±Õ°ü(closure)Ïà¹ØµÄ×ÊÁÏ£¬Ð´µÄ´ó¶àÊǷdz£µÄѧÊõºÍרҵ¡£¶ÔÓÚ³õѧÕßÀ´Ëµ±ð˵Àí½â±Õ°üÁË£¬¾ÍÁ¬ÎÄ×ÖÐðÊö¶¼ºÜÄÑ¿´¶®¡£×«Ð´´ËÎĵÄÄ¿µÄ¾ÍÊÇÓÃ×îͨË×µÄÎÄ×Ö½Ò¿ªJavascript±Õ°üµÄÕæʵÃæÄ¿¡£
¡¡¡¡Ò»¡¢Ê²Ã´ÊDZհü£¿
¡¡¡¡“¹Ù·½”µÄ½âÊÍÊÇ£ºËùν“±Õ°ü”£¬Ö¸µÄÊÇÒ»¸öÓµÓÐÐ ......
ʼþÔ´¶ÔÏó
event.srcElement.tagName
event.srcElement.type
²¶»ñÊÍ·Å
event.srcElement.setCapture();
event.srcElement.releaseCapture();
ʼþ°´¼ü
event.keyCode
event.shiftKey
event.altKey
event.ctrlKey
ʼþ·µ»ØÖµ
event.returnValue
Êó±êλÖÃ
eve ......
<html>
<body>
<table width="200" border="1" id="tb">
<tr id="r1">
<td><input type="checkbox" name="ck" value="1"></td>
<td>abc</td>
</tr>
</table>
<p>
<input type="button" onClick="add();" value="add"/> ......