ÓÐ¹Ø JavaScript µÄ 10 ¼þÈÃÈ˷ѽâµÄÊÂÇé
JavaScript ¿ÉËãÊÇÊÀ½çÉÏ×îÁ÷Ðеıà³ÌÓïÑÔ£¬ËüÔø±» Web ¿ª·¢Éè¼ÆʦÌùÉÏجÃεıêÇ©£¬ËäÈ»ÕæÕýµÄجÃÎÆäʵÊÇ DOM
API£¬Õâ¸ö±»´óÁ¿µÄ¿ª·¢ÓëÉè¼ÆʦËæÊÖÄéÀ´ÔöÇ¿ËûÃÇµÄ Web Ç°¶ËµÄ½Å±¾ÓïÑÔ£¬Èç½ñÔ½À´Ô½±»ÖØÊÓ£¬ËäÔòÈç´Ë£¬JavaScript
ÈÔȻӵÓкܶàÈÃÈ˷ѽâµÄ¶«Î÷¡£
1. ËüÒÔ Java ÃüÃû£¬µ«²¢²»ÊÇ Java
Ëü×î³õ½Ð Mocha£¬ ½ÓןÄÃûΪ LiveScript£¬×îºó²ÅÈ·¶¨ÃüÃûΪ JavaScript£¬¸ù¾ÝÀúÊ·¼Ç¼£¬Java µÄÃüÃûÓë
Netscape ºÍ Sun Ö®¼äµÄºÏ×÷Óйأ¬×÷Ϊ½»»»Ìõ¼þ£¬Netscape ÔÚËûÃDZ¸ÊÜ»¶ÓµÄä¯ÀÀÆ÷Öд´½¨ÁË Java
ÔËÐÐʱ¡£ÖµµÃÒ»ÌáµÄÊÇ£¬Õâ¸öÃû×ֵijǫ̈¼¸½üÒ»¸öÍæЦ£¬ÒªÖªµÀ£¬LiveScript ºÍ Java ÔÚ¿Í»§¶Ë½Å±¾·½Ãæ´æÔڵжԹØϵ¡£
²»¹ÜÔõô˵£¬ÈËÃǺóÀ´²»µÃ²»Ò»ÔÙ³ÎÇåµÄÒ»¼þʾÍÊÇ£¬JavaScript ºÍ Java ºÁÎÞ¹Øϵ¡£
2. Null ÊǸö¶ÔÏó£¿
¿´¿´Õâ¶Î´úÂ룬Ëü·µ»ØµÄÊÇ object¡£
ÕâʵÔÚÁîÈ˷ѽ⣬¼ÙÈç null ±íʾ¿ÕÖµ£¬ËüÔõô¿ÉÒÔÊǶÔÏ󣿼òµ¥Ëµ£¬ËüÊÇ JavaScript ×î³õ°æ±¾µÄ´íÎó£¬Õâ¸ö´íÎóÉõÖÁ±»Î¢ÈíµÄ JScript Ö±½Ó½èÓá£
3. NaN !== NaN
NaN£¬±íʾһ¸ö·ÇÊý×ÖµÄÖµ£¬È»¶øÎÊÌâÊÇ£¬NaN²»µÈÓÚÈκζ«Î÷£¬ÉõÖÁ²»µÈÓÚËü×Ô¼º¡£
ÕâÏÔÈ»²»¶Ô£¬ÊÂʵÉÏ£¬Èç¹ûÒªÅжÏÒ»¸öֵȷʵÊÇ NaN£¬ÄãÐèÒªÓà isNaN() º¯Êý¡£
4. È«¾Ö±äÁ¿
¶ÔÈ«¾Ö±äÁ¿µÄÒÀÀµÒ»Ö±±»ÊÓΪ JavaScript ×µÄ²¿·Ö£¨ECMA µÄ JavaScript 5 ÒѾȥµôÁËÈ«¾Ö±äÁ¿£¬Çë²ÎÔÄ ECMA ÍƳö JavaScript 5
- ÒëÕß×¢£©¡£¶Ô¼òµ¥µÄÒ³Ã棬ÕâÎÞËùν£¬µ«¸´ÔÓµÄÒ³Ã棬Èç¹û°üº¬´óÁ¿ JavaScript ½Å±¾£¬ÄãºÜÄÑÖªµÀij¸öÈ«¾Ö±äÁ¿ÊÇÔÚÄÄÀïÉùÃ÷µÄ£¬Èç¹û¼¸¸öÈ«¾Ö±äÁ¿²»Ð¡ÐÄÖØÃû£¬¾Í»áÒý·¢´íÎó¡£
5. ÄÇЩͳͳ±»Ì½²âΪ Mozilla User-Agent µÄä¯ÀÀÆ÷
±ØÐë³ÐÈÏ£¬ÊÂʵÉÏ£¬Õâ²»ÊÇ JavaScript µÄ´í£¬ÊǸ÷¸öä¯ÀÀÆ÷ÓÐÒâΪ֮¡£±ÈÈ磬ÒÔÏÂÊÇÓà JavaScript ̽²â Safari ʱµÃµ½µÄ½á¹û£º
ÊÇ·ñ×¢Òâµ½ÆäÖеĵÚÒ»¸öµ¥´Ê Mozilla/5.0
£¬ÎªÊ²Ã´ Safari »á±»Ì½²âΪ
Mozilla£¬¾¡¹Ü Safari ºóÀ´ÒѾ¾ÀÕýÕâÒ»ÎÊÌ⣬µ«ÈÔÈ»²»ÄܽâÊÍΪʲôËüÃÇÒªÕâÑùÎ󵼿ª·¢Õß¡£ÊÂʵÉÏ£¬Äã»á·¢ÏÖ£¬¾ø´ó¶àÊýä¯ÀÀÆ÷°ÑËûÃǵÄ
User Agent ÉèÖÃΪ Mozilla£¬´ð°¸Òª»Øµ½10ÄêÇ°£¬Õâ¸ü¶àÊÇÒ»ÖÖ²ßÂÔ¡£
User Agent ÊÇÒ»¶ÎÓÃÀ´±êʶµ±Ç°ä¯ÀÀÆ÷Éí·ÝµÄ×Ö·û´®£¬ÊÀ½çÉϵÚÒ»¸öä¯ÀÀÆ÷ Mosaic£¬ ÔøÕâÑù±êÖ¾×Ô¼º£º
ÕâºÜºÏÀí£¬Òò´Ëµ± Netscape ³öÀ´µÄʱºò£¬Ëü±£ÁôÁË Mosaic Õâ¸ö´«Í³£¬»¹ÔÚºóÃæÌí¼ÓÁËÒ»¸ö¼ÓÃÜ·½Ê½²¿·Ö¡£
µ½Ä¿Ç°ÎªÖ¹£¬Ò»Çа²ºÃ£¬Ö±µ½ IE3 ·¢²¼£¬µ± IE3 ·¢²¼µÄʱºò£¬Netscape
ÕýÈçÈÕÖ
Ïà¹ØÎĵµ£º
ÏÂÃæÊÇÊ®¸ö×îÅ£µÄÒ²ÊÇ×îÁ÷ÐеÄJavascript¿ò¼Ü¡£ËüÃÇÍêÈ«¿ÉÒÔµ£ÈÎÄ¿Ç°ÊÀ½çÉϼ¸ºõËùÓÐһЩºÍAjax¼¼ÊõÏà¹ØµÄºÍͼÐνçÃæÏà¹ØµÄÒ»Çй¦ÄÜ¡£
jQuery
http://jquery.com/
Èç¹û½ñÌìÄ㻹²»ÖªµÀjQueryµÄ»°£¬ÄÇô×÷Ϊһ¸ö³ÌÐòÔ±Äã¿ÉÄÜÕæµÄÊÇ´Ó»ðÐÇÀ´µÄÁË¡£Õâ¿ÖÅÂÊÇAjaxÖÐÓ¦ÓÃ×î¹ãµÄ¿ò¼Ü¡£°üÀ¨ÁËÐí¶àºÜ²»´íµÄUI×é¼þ£¬×ö³öÍø ......
1 >ÆÁ±Î¹¦ÄÜÀà
1.1 ÆÁ±Î¼üÅÌËùÓмü
<script. language="javascript">
<!--
function document.onkeydown(){
event.keyCode = 0;
event.returnvalue = false;
}
-->
</script>
1.2 ÆÁ±ÎÊó±êÓÒ¼ü
ÔÚbody±êÇ©Àï¼ÓÉÏoncontextmenu=self.event.returnvalue=false
»òÕß
<scri ......
//×Ô´øµÄ´òÓ¡Ô¤ÀÀ WebBrowser.ExecWB(1,1) ´ò¿ª
Web.ExecWB(2,1) ¹Ø±ÕÏÖÔÚËùÓеÄIE´°¿Ú£¬²¢´ò¿ªÒ»¸öд°¿Ú
Web.ExecWB(4,1) ±£´æÍøÒ³
Web.ExecWB(6,1) ´òÓ¡
Web.ExecWB(7,1) ´òÓ¡Ô¤ÀÀ
Web.ExecWB(8,1) ´òÓ¡Ò³ÃæÉèÖÃ
Web.ExecWB(10,1) ²é¿´Ò ......
JavaScript½âÎö¶ÁÈ¡XMLÎļþ£¬Ö÷Òª¾ÍÊǼÓÔز¢½âÎöXMLÎļþ£¬È»ºó¾Í¿ÉÒÔ²âÊÔ½âÎöµÄXMLÎļþµÄÄÚÈÝ£¬´òÓ¡Êä³öÀ´¡£
±àдÁËÒ»¸öJavaScriptµÄÀàÀ´ÊµÏÖ¶ÁÈ¡Ò»¸öXMLÎļþÖеÄÊý¾Ý£¬ÊµÏÖ´úÂëÈçÏÂËùʾ£º
<mce:script type="text/javascript"><!--
/**
* @author Shirdrn
*/
function XMLDoc(){}; // ¶¨ÒåÒ»¸öXM ......