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

ʹÓÃJavaScriptºÍAjax·¢³öÒì²½ÇëÇóÏê½â

´ò¿ªÇëÇó
¡¡¡¡ÓÐÁËÒªÁ¬½ÓµÄ URL ºó¾Í¿ÉÒÔÅäÖÃÇëÇóÁË¡£¿ÉÒÔÓà XMLHttpRequest ¶ÔÏóµÄ open() ·½·¨À´Íê³É¡£¸Ã·½·¨ÓÐÎå¸ö²ÎÊý:
request-type:·¢ËÍÇëÇóµÄÀàÐÍ¡£µäÐ͵ÄÖµÊÇ GET »ò POST£¬µ«Ò²¿ÉÒÔ·¢ËÍ HEAD ÇëÇó¡£
url:ÒªÁ¬½ÓµÄ URL¡£
asynch:Èç¹ûÏ£ÍûʹÓÃÒì²½Á¬½ÓÔòΪ true£¬·ñÔòΪ false¡£¸Ã²ÎÊýÊÇ¿ÉÑ¡µÄ£¬Ä¬ÈÏΪ true¡£
username:Èç¹ûÐèÒªÉí·ÝÑéÖ¤£¬Ôò¿ÉÒÔÔÚ´ËÖ¸¶¨Óû§Ãû¡£¸Ã¿ÉÑ¡²ÎÊýûÓÐĬÈÏÖµ¡£
password:Èç¹ûÐèÒªÉí·ÝÑéÖ¤£¬Ôò¿ÉÒÔÔÚ´ËÖ¸¶¨¿ÚÁî¡£¸Ã¿ÉÑ¡²ÎÊýûÓÐĬÈÏÖµ¡£
¡¡¡¡Í¨³£Ê¹ÓÃÆäÖеÄÇ°Èý¸ö²ÎÊý¡£ÊÂʵÉÏ£¬¼´Ê¹ÐèÒªÒì²½Á¬½Ó£¬Ò²Ó¦¸ÃÖ¸¶¨µÚÈý¸ö²ÎÊýΪ “true”¡£ÕâÊÇĬÈÏÖµ£¬µ«¼á³ÖÃ÷È·Ö¸¶¨ÇëÇóÊÇÒì²½µÄ»¹ÊÇͬ²½µÄ¸üÈÝÒ×Àí½â¡£
¡¡¡¡½«ÕâЩ½áºÏÆðÀ´£¬Í¨³£»áµÃµ½ Çåµ¥ 9 ËùʾµÄÒ»ÐдúÂë¡£
¡¡¡¡Çåµ¥ 9. ´ò¿ªÇëÇó
   function getCustomerInfo() {
     var phone = document.getElementById("phone").value;
     var url = "/cgi-local/lookupCustomer.php?phone=" + escape(phone);
     request.open("GET", url, true);
   }
¡¡¡¡Ò»µ©ÉèÖúÃÁË URL£¬ÆäËû¾Í¼òµ¥ÁË¡£¶àÊýÇëÇóʹÓà GET ¾Í¹»ÁË(ºóÃæµÄÎÄÕÂÖн«¿´µ½ÐèҪʹÓà POST µÄÇé¿ö)£¬ÔÙ¼ÓÉÏ URL£¬Õâ¾ÍÊÇʹÓà open() ·½·¨ÐèÒªµÄÈ«²¿ÄÚÈÝÁË¡£
¡¡¡¡ÌôÕ½Òì²½ÐÔ
¡¡¡¡±¾ÏµÁеĺóÃæһƪÎÄÕÂÖУ¬ÎÒ½«Óúܶàʱ¼ä±àдºÍʹÓÃÒì²½´úÂ룬µ«ÊÇÄúÓ¦¸ÃÃ÷°×Ϊʲô open() µÄ×îºóÒ»¸ö²ÎÊýÕâôÖØÒª¡£ÔÚÒ»°ãµÄÇëÇó/ÏìӦģÐÍÖУ¬±ÈÈç Web 1.0£¬¿Í»§»ú(ä¯ÀÀÆ÷»òÕß±¾µØ»úÆ÷ÉÏÔËÐеĴúÂë)Ïò·þÎñÆ÷·¢³öÇëÇ󡣸ÃÇëÇóÊÇͬ²½µÄ£¬»»¾ä»°Ëµ£¬¿Í»§»úµÈ´ý·þÎñÆ÷µÄÏìÓ¦¡£µ±¿Í»§»úµÈ´ýµÄʱºò£¬ÖÁÉÙ»áÓÃijÖÖÐÎʽ֪ͨÄúÔڵȴý:
ɳ©(ÌرðÊÇ Windows ÉÏ)¡£
ÐýתµÄƤÇò(ͨ³£ÔÚ Mac »úÆ÷ÉÏ)¡£
Ó¦ÓóÌÐò»ù±¾É϶³½áÁË£¬È»ºó¹ýÒ»¶Îʱ¼ä¹â±ê±ä»¯ÁË¡£
¡¡¡¡ÕâÕýÊÇ Web Ó¦ÓóÌÐòÈÃÈ˸е½±¿×¾»ò»ºÂýµÄÔ­Òò —— ȱ·¦ÕæÕýµÄ½»»¥ÐÔ¡£°´Ï°´Å¥Ê±£¬Ó¦ÓóÌÐòʵ¼ÊÉϱäµÃ²»ÄÜʹÓã¬Ö±µ½¸Õ¸Õ´¥·¢µÄÇëÇóµÃµ½ÏìÓ¦¡£Èç¹ûÇëÇóÐèÒª´óÁ¿·þÎñÆ÷´¦Àí£¬ÄÇôµÈ´ýµÄʱ¼ä¿ÉÄܺܳ¤(ÖÁÉÙÔÚÕâ¸ö¶à´¦ÀíÆ÷¡¢DSL ûÓеȴýµÄÊÀ½çÖÐÊÇÈç´Ë)¡£
¡¡¡¡¶øÒì²½ÇëÇó²» µÈ´ý·þÎñÆ÷ÏìÓ¦¡£·¢ËÍÇëÇóºóÓ¦ÓóÌÐò¼ÌÐøÔËÐС£Óû§ÈÔÈ»¿ÉÒÔÔÚ Web ±íµ¥ÖÐÊäÈëÊý¾Ý£¬ÉõÖÁÀ뿪±íµ¥¡£Ã»ÓÐÐýתµÄƤÇò»òÕßɳ©£¬Ó¦ÓóÌÐòҲûÓÐÃ÷ÏԵĶ³½á¡£·þÎñÆ÷ÇÄÇĵØÏìÓ¦ÇëÇó£¬Íê³Éºó


Ïà¹ØÎĵµ£º

css,javascriptµÄÔ¤¼ÓÔØ

ΪÁËÌá¸ßÍøÕ¾µÄ¼ÓÔØËٶȣ¬ÓÐÒ»¸öºÜÖØÒªµÄÊֶξÍÊÇÔÚÓû§ä¯ÀÀ¹ý³ÌÖеÄÉÏÓÎÍøÕ¾×öÒ»¸öÎļþµÄÔ¤¼ÓÔØ¡£Ô¤¼ÓÔØÎļþÒ»°ãÓÐÁ½ÖÖ³£Óõķ½Ê½£ºxhrºÍ¶¯Ì¬²åÈë½ÚµãµÄ·½Ê½¡£¶¯Ì¬²åÈë½ÚµãÊÇ×îΪ¼òµ¥Ò²×îΪ¹ã·ºµÄÒ»ÖÖÒì²½¼ÓÔØ·½Ê½(ÀýÈçyuiµÄGetÄ£¿é)£¬È»ºóʹÓö¯Ì¬²åÈë½Úµã·½·¨¼ÓÔصÄÎļþ¶¼»áÔÚ¼ÓÔغóÁ¢¼´Ö´ÐУ¬javascriptµÄÖ´ÐÐÒ»·½Ãæ»áÕ ......

AjaxÌá½»±íµ¥ òËÆÖ»ÄÜÓÃpost

     ÒÔÇ°Ìá½»±íµ¥µÄ·½·¨ÊÇsubmit£¬µ«ÊÇÕâÑùµÄ»°ÎÞ·¨Ê¹ÓÃAjax£¬Ò»Ìá½»¾ÍÒâζ×ÅÐèҪˢÐÂÒ³Ãæ¡£ÁíÒ»ÖÖ·½·¨ÊÇÔÚurlÉÏÃæ¼ÓÉÏparameterÀ´·¢ËÍ±íµ¥£¬µ«ÊÇÕâÑù»á±©Â¶·¢Ë͵ÄÄÚÈÝ¡£µ«ÊÇÈç¹ûÓÃAjax·¢ËÍ±íµ¥µÄ»°¾ÍÄܱÜÃâÉÏÃæÁ½ÖÖÎÊÌâ¡£
     µ«ÊÇÎÒ֮ǰ×Ô¼ºÐ´µÄʱºò£¬×ÜÊÇÌá½»µÄÊÇnullÖµ£¬ÔË ......

javascriptÕýÔò±í´ïʽµÄ»ù±¾ÖªÊ¶


1 javascript ÕýÔò
¶ÔÏó´´½¨ ºÍÓ÷¨
ÉùÃ÷javascript ÕýÔò
±í´ïʽ
¸´ÖÆ´úÂë
´úÂëÈçÏÂ:

var reCat = new RegExp("cat");
ÄãÒ²¿ÉÒÔ
var reCat = /cat/; //Perl ·ç¸ñ £¨ÍƼö£©

2 ѧϰ×î³£ÓÃµÄ test exec match search replace split 6¸ö·½·¨
1£© test ¼ì²éÖ¸¶¨µÄ×Ö·û´®ÊÇ·ñ´æÔÚ
¸´ÖÆ´úÂë
......

javascript ÕýÔò


1 javascript ÕýÔò
¶ÔÏó´´½¨ ºÍÓ÷¨
ÉùÃ÷javascript ÕýÔò
±í´ïʽ
¸´ÖÆ´úÂë
´úÂëÈçÏÂ:

var reCat = new RegExp("cat");
ÄãÒ²¿ÉÒÔ
var reCat = /cat/; //Perl ·ç¸ñ £¨ÍƼö£©

2 ѧϰ×î³£ÓÃµÄ test exec match search replace split 6¸ö·½·¨
1£© test ¼ì²éÖ¸¶¨µÄ×Ö·û´®ÊÇ·ñ´æÔÚ
¸´ÖÆ´úÂë
......

javascriptÖÐÈÕÆÚº¯ÊýDateÏê½â

¶ÔÏó: ÈÕÆÚ
DateÊÇjavascriptÔ¤¶¨ÒåÖ÷Ìâ. ¸ÃÖ÷Ìâ°üÀ¨¿É»ñÈ¡»òÉèÖÃϵͳÈÕÆÚ¡¢Ê±¼ä¡¢Ô¡¢ÈÕ¡¢Ð¡Ê±¡¢·ÖÖÓ¡¢ÃëµÈµÈ¡£°üÀ¨º¯Êý·½·¨»ñÈ¡ UTC ¸ñʽµÄÈÕÆÚ¡£ UTC Êǹú¼Ê±ê׼ʱ¼ä£¬Ò²³Æ¸ñÁÖÄáÖαê׼ʱ¼ä£¨Greenwich Mean Time£©¡£
ÔÚʹÓÃÕâЩ·½·¨Ç°¿ÉÏÈÉùÃ÷Ò»¸öÖ÷Ìâ¡£
´´½¨ÐÂÈÕÆÚÖ÷Ìâ
ʾÀý´úÂ룺var exd = new Date();
µ÷ÓÃ"n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ