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

firefoxÓëIE¶ÔjavascriptºÍ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Ö»ÄÜÔÚʼþ·¢ÉúµÄÏÖ³¡Ê¹ÓÃ. Firefox±ØÐë´ÓÔ´´¦¼ÓÈëevent×÷²ÎÊý´«µÝ¡£IeºöÂԸòÎÊý£¬ÓÃwindow.eventÀ´¶ÁÈ¡¸Ãevent¡£
½â¾ö·½·¨:
IE&Firefox:
Submitted(event)"/> …
<script language="javascript">
function Submitted(evt) {
evt=evt?evt:(window.event?window.event:null);
}
</script>
9.event.xÓëevent.yÎÊÌâ
˵Ã÷:IEÏÂ,even¶ÔÏóÓÐx,yÊôÐÔ,µ«ÊÇûÓÐpageX,pageYÊôÐÔ;FirefoxÏÂ,even¶ÔÏóÓÐpageX,pageYÊôÐÔ,µ«ÊÇûÓÐx,yÊôÐÔ.
½â¾ö·½·¨:ʹÓÃmX(mX = event.x ? event.x : e


Ïà¹ØÎĵµ£º

javascript stuffs

Primitive types
1. undefined, null, boolean, number, string; undefined is derived from null.
e.g. var tmp; typeof tmp == undefined.
e.g. void(javascript:aler(¡®x¡¯)) == undefined.
e.g. undefined==null
2. NaN!=NaN isNaN(¡°123¡±)==false isNaN(¡°blue¡±)==true ......

JavaScriptʵÏÖÒ³Ãæ´«Öµ

ÎÒ»¹ÊDzËÄñ£¬Çë´ó¼Ò¶àÖ¸½Ì£¡
Ò³ÃæÒ»£º
<html>
 <head>
  <title> Ò³Ãæ´«ÖµÒ» </title>
  <script>
    function funShow()
 {
    var arr=new Array(6);
       var arrs = showModalDialog("Ò³ ......

javascriptµÄhistory.go( 1)

javascriptµÄhistory.go(-1)
echo '<script language="javascript">{alert("ÁôÑÔ²»ÄÜΪ¿Õ!");history.go(-1);}</script>';}
echo '<script language="javascript">{alert("ÁôÑÔ²»ÄÜΪ¿Õ!");return true;}</script>';}
ÕâÊDz»Ë¢ÐÂÒ³ÃæµÄ·½Ê½ ......

ÎÒÈçºÎ¿´´ýDIV+CSS¼Ü¹¹(ÐøÒ»)

ÔÚд¡¶ÎÒÈçºÎ¿´´ýDIV+CSS¡·µÄʱºò
ÎÒÏëµ½£º
´úÂëûÓÐÐÐÓë²»Ðеķֱð
¶øÖ»ÓкÃÓë²»ºÃµÄ²î¾à
ºÃÓë²»ºÃ¶¼ÄÜÍê³ÉÏàÓ¦µÄ¹¦ÄÜ
Ò»¸ö¹¦ÄÜÉÙÁËÄÜд£¬¶àÁËÒ²ÄÜд
±à³ÌÓïÑÔ¾ÍÄÇô¼¸¸ö¹Ø¼ü×Ö¡¢ÄÇô¼¸Ìõ¿ØÖÆÓï¾ä
ËäÈ»¿ò¼Ü»òÀà¿âµÄÀàºÜ¶à
µ«Ò²²»ÊÇû¸öÊýµÄ
¿ÉÊÇÄÇЩ¼ÆËã»ú´óʦÃÇ°¡
È´ÄÜд³öÈÃÈ˾õµÃ“ÃÀ”µÄ´úÂë
ÎªÊ ......

Èç¹ûÔÚCHtmlDialogÖе÷ÓÃJavascriptº¯Êý

// µ÷ÓÃÒ³ÃæµÄˢз½·¨
     IHTMLWindow2* pWindow;
     IHTMLDocument2*   pDocument; 
     HRESULT hr = GetDHtmlDocument(&pDocument);  
     hr = pDocument->get_pa ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ