IEºÍFirefoxÔÚJSºÍCSS·½ÃæµÄ¼æÈÝÐÔ
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,ÒÔ±ÜÃâÆçÒå.
6.constÎÊÌâ
˵Ã÷:
FirefoxÏÂ,¿ÉÒÔʹÓÃconst¹Ø¼ü×Ö»òvar¹Ø¼ü×ÖÀ´¶¨Òå³£Á¿;
IEÏÂ,Ö»ÄÜʹÓÃvar¹Ø¼ü×ÖÀ´¶¨Òå³£Á¿.
½â¾ö·½·¨:ͳһʹÓÃvar¹Ø¼ü×ÖÀ´¶¨Òå³£Á¿.
7.input.typeÊôÐÔÎÊÌâ
˵Ã÷:IEÏÂinput.typeÊôÐÔΪֻ¶Á;µ«ÊÇFirefoxÏÂinput.typeÊôÐÔΪ¶Áд.
8.window.eventÎÊÌâ
˵Ã÷:window.eventÖ»ÄÜÔÚIEÏÂÔËÐÐ,¶ø²»ÄÜÔÚFirefoxÏÂÔËÐÐ,ÕâÊÇÒòΪFirefoxµÄeventÖ»ÄÜÔÚʼþ·¢ÉúµÄÏÖ³¡Ê¹ÓÃ.
½â¾ö·½·¨:
IE:
³ÌÐò´úÂë
<input name="Button8_1" type="button" value="IE" onclick="javascript:gotoSubmit8_1()"/>
...
<script language="javascript">
function gotoSubmit8_1() {
...
alert(window.event); //use window.event
...
}
</script>
IE&Firefox:
³ÌÐò´úÂë
<input name="Button8_2" type="button" value="IE" onclick="javascript:gotoSubmit8_2(event)"/>
...
<script language="javascript">
Ïà¹ØÎĵµ£º
CSS´úÂë
<style>
body{
background-color:#f4f4f4;
font-size:12px;
}
div.test{
width:200px;
height:100px;
border:1px solid red;
border-top:4px solid red;
padding:10px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
}
</style>
HTML´úÂë
<div class="test"&g ......
ÏàÐźܶàÈ˶¼·Ç³£Ï²»¶ÓÃdiv+css²¼¾Ö,ÎÞÂÛÄãÊÇÇ°¶Ë¿ª·¢Õߣ¬»¹ÊǺǫ́³ÌÐòÔ±£¬ÒòΪËüµÄºÃ´¦ÊµÔÚÌ«¶à£¬¿ÉÒÔÓúÜÉٵĴúÂëÀ´¿ØÖƲ¼¾Ö£¬È»ºóÓÃCSS±íÏÖÆäÐÎ̬£¬±íÏÖºÍÑùʽ·ÖÀë¡£¶øÇÒÔÚSEO·½Ã棬Ëü»¹ÄÜÌṩ30%µÄÓÅ»¯£¬ÎÒÃǺÎÀÖ¶ø²»ÎªÄØ¡£
ºÜ¶àÈ˶¼»áÅöµ½ÈçÌâµÄ²¼¾ÖÎÊÌ⣬½â¾ö·½°¸ºÜ¶à£¬¿ÉÒÔÓñ³¾°Í¼À´Ìî³ä£¬»òÓÃjsÀ´¿ØÖÆ£¬µ«ÖÕ²»Ê ......
CSS Hack ÊÇÔÚ±ê×¼ CSS û°ì·¨¼æÈݸ÷ä¯ÀÀÆ÷ÏÔʾЧ¹ûʱ²Å»áÓÃÉϵIJ¹¾È·½·¨,ÔÚ¸÷ä¯ÀÀÆ÷³§É̽âÎö CSS ûÓдï³ÉÒ»ÖÂÇ°,ÎÒÃÇÖ»ÄÜÓÃÕâÑùµÄ·½·¨À´Íê³ÉÕâÑùµÄÈÎÎñ¡£ÍøÉÏÄã¿ÉÄÜÄÜËÑË÷µ½Ò»´ó¶ÑµÄ CSS Hack£¬µ«ÊÇÎÒ½ñÌì·¢²¼µÄÄã¿ÉÄܲ¢²»¶¼ºÜÁ˽⣬ÒòΪÕâЩ¶¼ÊÇÖ»Õë¶Ôµ¥¶ÀÒ»¸öä¯ÀÀÆ÷µÄ CSS Hack¡£
ΪÁËÏòÄãչʾÕâЩ CSS Hack ÊÇ·ñÕý³£Ô ......
CSS ¶Ôä¯ÀÀÆ÷µÄ¼æÈÝÐÔÓÐʱÈÃÈ˺ÜÍ·ÌÛ£¬»òÐíµ±ÄãÁ˽⵱Öеļ¼ÇɸúÔÀí£¬¾Í»á¾õµÃÒ²²»ÊÇÄÑÊ£¬´ÓÍøÉÏÊÕ¼¯ÁËIE7,6ÓëFireofxµÄ¼æÈÝÐÔ´¦Àí·½·¨²¢ÕûÀíÁË Ò»Ï¡£¶ÔÓÚweb2.0µÄ¹ý¶È£¬Ç뾡Á¿ÓÃxhtml¸ñʽд´úÂ룬¶øÇÒDOCTYPE Ó°Ïì CSS ´¦Àí£¬×÷ΪW3CµÄ±ê×¼£¬Ò»¶¨Òª¼Ó DOCTYPEÉùÃ÷¡£
CSS¼¼ÇÉ
1.d ......