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

javascript ÔÚ ie ºÍ firefox Çø±ð

1.document.formName.item("itemName") ÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃdocument.formName.item("itemName")»òdocument.formName.elements["elementName"];FirefoxÏÂ,Ö»ÄÜʹÓÃdocument.formName.elements["elementName"].
½â¾ö·½·¨:ͳһʹÓÃdocument.formName.elements["elementName"].
JQUERY:
$("#idName")
   
2.¼¯ºÏÀà¶ÔÏóÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃ()»ò[]»ñÈ¡¼¯ºÏÀà¶ÔÏó;FirefoxÏÂ,Ö»ÄÜʹÓÃ[]»ñÈ¡¼¯ºÏÀà¶ÔÏó.
½â¾ö·½·¨:ͳһʹÓÃ[]»ñÈ¡¼¯ºÏÀà¶ÔÏó.
JQUERY:[]
JQUERY.each(obj,callback) ͨÓõıéÀú·½·¨£¬¿ÉÓÃÓÚ±éÀúÊý×éºÍ¶ÔÏó
   
3.×Ô¶¨ÒåÊôÐÔÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓûñÈ¡³£¹æÊôÐԵķ½·¨À´»ñÈ¡×Ô¶¨ÒåÊôÐÔ,Ò²¿ÉÒÔʹÓÃgetAttribute()»ñÈ¡×Ô¶¨ÒåÊôÐÔ;FirefoxÏÂ,Ö»ÄÜʹÓÃgetAttribute()»ñÈ¡×Ô¶¨ÒåÊôÐÔ.
½â¾ö·½·¨:ͳһͨ¹ýgetAttribute()»ñÈ¡×Ô¶¨ÒåÊôÐÔ.
JQUERY: attr
attr(name) //È¡µÃÒ»¸öÆ¥ÅäÔªËصÄÊôÐÔÖµ. return Object£»
attr(properties) // ½«Ò»¸ö"Ãû/Öµ"ÐÎʽµÄ¶ÔÏóÉèÖÃΪËùÓÐÆ¥ÅäÔªËصÄÊôÐÔ. return jQuery;
attr(key,value) //ΪËùÓÐÆ¥ÅäÔªËØÉèÖÃÒ»¸öÊôÐÔÖµ¡£
attr(key,fn) //ΪËùÓÐÆ¥ÅäÔªËØÉèÖÃÒ»¸ö¼ÆËãµÄÊôÐÔÖµ¡£
removeAttr(name) //´Óÿ¸öÆ¥ÅäµÄÔªËØɾ³ýÊôÐÔ
   
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,ÒÔ±ÜÃâÆçÒå.
   
6.constÎÊÌâ
˵Ã÷:FirefoxÏÂ,¿ÉÒÔʹÓÃconst¹Ø¼ü×Ö»òvar¹Ø¼ü×ÖÀ´¶¨Òå³£Á¿;IEÏÂ,Ö»ÄÜʹÓÃvar¹Ø¼ü×ÖÀ´¶¨Òå³£Á¿.
½â¾ö·½·¨:ͳһʹÓÃvar¹Ø¼ü×ÖÀ´¶¨Òå³£Á¿.
   
   
7.input.typeÊôÐÔÎÊÌâ
˵Ã÷:IEÏÂinput.typeÊôÐÔΪֻ¶Á;µ«ÊÇFirefoxÏÂinput.typeÊôÐÔΪ¶Áд.
   
   
8.window.eventÎÊÌâ
˵Ã÷


Ïà¹ØÎĵµ£º

javascriptЧÂʾ­Ñé̸(Ò»)

±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔ­À´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾­Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾­¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷Ô­Òò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......

JavaScriptѧϰ±Ê¼Ç£¨Ò»£©

1.×î³õÒýÈëJavaScriptµÄÖ÷ҪĿµÄÊÇÔÚ¿Í»§¶Ë´¦ÀíһЩÊäÈëµÄÓÐЧÐÔÑéÖ¤¡£¶øÔÚ´Ë֮ǰҪ½øÐÐÓÐЧÐÔÑéÖ¤£¬¾Í±ØÐëÓë·þÎñÆ÷½øÐÐÍù·µµÄ½»»¥¡£
2.Ò»¸öÍêÕûµÄJavaScriptʵÏÖÊÇÓÉÒÔÏÂ3¸ö²»Í¬²¿·Ö×é³ÉµÄ£º
ºËÐÄ£¨ECMAScript£©
Îĵµ¶ÔÏóÄ£ÐÍ£¨DOM£©
ä¯ÀÀÆ÷¶ÔÏóÄ£ÐÍ£¨BOM£©
   ECMAScript×÷ΪJavaScriptµÄºËÐÄ£¬ÃèÊöÁ˸ÃÓï ......

JavaScript µ¹¼ÇʱÆ÷

¿´¹ýÏã¸ÛºÍ°ÄÃŻعéµÄµ¹¼ÇʱÆ÷ûÓУ¬ÊDz»ÊÇÏë¸ø×Ô¼ºµÄ±È½ÏÓÐÒâÒåµÄÈÕ×ÓÒ»¸ö¼ÇʱÆ÷ÌáÐÑ×Ô¼º£¬JavaScript¸øÁËÎÒÃÇÕâ¸ö»ú»áȥʵÏÖÎÒÃǵÄÏë·¨£¬¿´¿´ÏÂÃæµÄÀý×Ó£º
ÔÚ<body>ºÍ</body>±êÇ©¼äÊäÈëÒÔÏ´úÂë
<SCRIPT LANGUAGE="JavaScript">
var urodz= new Date("December 25,2002");
var s="Ê¥µ®½Ú";
//»ñÈ¡ ......

JavascriptÓ¦Óõļ¸¸öʵÀý

1.ÀûÓÃJavascriptʵÏÖ²âÊÔä¯ÀÀÆ÷ÀàÐÍÔÙµ÷ÓÃÏàÓ¦µÄÖ÷Ò³
¡¡¡¡ÓÉÓÚIEºÍNetscapeµÄijЩ²»¼æÈÝ£¬Ê¹µÃÖ÷Ò³ÖÆ×÷³öÀ´ºóÔÚÁ½ÕßÖÐÓнϴó²î±ð£¬ÓеÄÉõÖÁ²»ÄÜʹÓá£Îª±ãÓÚ¹ÜÀí£¬×î¼ÑµÄ·½·¨¾ÍÊÇÏȲâÊÔä¯ÀÀÆ÷ÀàÐÍ£¬ÔÙµ÷ÓÃÏàÓ¦µÄÖ÷Ò³¡£
¡¡¡¡ËüµÄ×ö·¨¾ÍÊÇÔÚ´ËÒ³ÉÏÉèÖÃÈ磺
¡¡¡¡£¼html£¾
¡¡¡¡£¼head£¾
¡¡¡¡£¼title£¾¼ì²âä¯ÀÀÆ÷£¼/title£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ