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

7 JavaScript Differences Between Firefox & IE

Although the days of long and tedious code branches to target specific browsers in JavaScript are over, once in a while it's still necessary to do some simple code branching and object detection to ensure that a certain piece of code is working properly on a user's machine. 
In this article, I'll outine 7 areas where Internet Explorer and Firefox differ in JavaScript syntax. In this article, I'll outine 7 areas where Internet Explorer and Firefox differ in JavaScript syntax. 
1. The CSS “float” property 1. The CSS “float” property
The basic syntax for accessing a specific css property for any given object is object.style.property , using camel casing to replace a hyphenated property. For example, to access the background-color property of a The basic syntax for accessing a specific css property for any given object is object.style.property , using camel casing to replace a hyphenated property. For example, to access the background-color property of a
whose ID is “header”, we would use the following syntax: whose ID is “header”, we would use the following syntax: 
document.getElementById( "header" ).style.backgroundColor= "#ccc" ; document.getElementById( "header" ).style.backgroundColor= "#ccc" ; 
But since the word “float” is already reserved for use in JavaScript, we cannot access the “float” property using object.style.float . Here is how we do it in the two browsers: But since the word “float” is already reserved for use in JavaScript, we cannot access the “float” property using object.style.float . Here is how we do it in the two browsers: 
The IE Syntax: The IE Syntax:
document.getElementById( "header" ).style.styleFloat = "left" ; document.getElementById( "header" )


Ïà¹ØÎĵµ£º

IEÓëFirefoxÏÂjavascript getyearÄê·ÝµÄ¼æÈÝÐÔд·¨

                    ǰ¼¸ÌìÔÚ²âÊÔÍøÕ¾¼æÈÝÐÔÎÊÌ⣬·¢ÏÖÔ­À´ÔÚIEÏÂÃæÕý³£µÄÏÔʾʱ¼äÔÚFirefox»ñÈ¡Äê·ÝÏÂÏÔʾ109
                &nb ......

Javascript²Ù×÷SelectºÍOption

×¢Òâ:OptionÖеÄOÊÇÒª´óдµÄ£¬²»È»Óï·¨±¨´í
1.¶¯Ì¬´´½¨select
      function createSelect(){
var mySelect = document.createElement("select");
          mySelect.id = "mySelect"; 
        ......

Àí½âJavascript±Õ°ü(closure)

Àí½âJavascript±Õ°ü(closure)
רÌâ Ô­Ìû http://www.w3cgroup.com/article.asp?id=87
´ËÎÄÓÃͨË×µÄÎÄ×Ö½éÉÜÁËJavascript±Õ°ü ¡£
¿´¹ýºó£¬ÎÒ¶Ôjavascript±Õ°ü¼òµ¥µÄÀí½â¾ÍÊÇ ÎÄÖеÚËÄ¡¢Îå¶ÎÖÐËù˵µÄ“ÔÚÄÚ´æÖÐά³ÖÒ»¸ö±äÁ¿£¬²»»á±»GC»ØÊÕ”¡£
µ±È»»¹ÐèҪѧϰ²ÅÄÜÉîÈëµÄÀí½âjavascript±Õ°ü
Ò»¡¢Ê²Ã´ÊDZհü£¿ ......

$wnd and $doc Calling native JavaScript with JSNI

$wnd and $doc Calling native JavaScript with JSNI
$wnd ÊÇʲô£¿
GWT provides the $wnd and $doc variables to refer to the window and document objects
GWTʹÓÃͨ¹ýJava Native methodʹÓÃËü£¬ÉùÃ÷Ò»¸önative·½·¨£¬½«º¬ÓÐJavaScriptµÄ·½·¨Ìå×¢ÊÍ¡£±àÒëÆ÷½«×¢ÊÍ¿éÄÚµÄÄÚÈÝÖð×ÖÊä³ö£¬Ê¹Ö®Óë±àÒë²úÉúµÄJavaScriptÕûº ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ