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

JavaScript ½âÎö JSON Êý¾Ý


J
SON £¨JavaScript Object Notation£©Ò»ÖÖ¼òµ¥µÄÊý¾Ý¸ñʽ£¬±Èxml¸üÇáÇÉ¡£ JSON ÊÇ JavaScript Ô­Éú¸ñʽ£¬ÕâÒâζ×ÅÔÚ JavaScript Öд¦Àí JSON Êý¾Ý²»ÐèÒªÈκÎÌØÊâµÄ API »ò¹¤¾ß°ü¡£
JSONµÄ¹æÔòºÜ¼òµ¥£º ¶ÔÏóÊÇÒ»¸öÎÞÐòµÄ“‘Ãû³Æ/Öµ’¶Ô”¼¯ºÏ¡£Ò»¸ö¶ÔÏóÒÔ“{”£¨×óÀ¨ºÅ£©¿ªÊ¼£¬“}”£¨ÓÒÀ¨ºÅ£©½áÊø¡£Ã¿¸ö“Ãû³Æ”ºó¸úÒ»¸ö“:”£¨Ã°ºÅ£©£»“‘Ãû³Æ/Öµ’ ¶Ô”Ö®¼äʹÓÓ,”£¨¶ººÅ£©·Ö¸ô¡£¾ßÌåϸ½Ú²Î¿¼http://www.json.org/json-zh.html
¾Ù¸ö¼òµ¥µÄÀý×Ó£º
js ´úÂë
function showJSON() {   
    var user =   
     {   
        "username":"andy",   
        "age":20,   
        "info": { "tel": "123456", "cellphone": "98765"},   
        "address":   
             [   
                 {"city":"beijing","postcode":"222333"},   
                 {"city":"newyork","postcode":"555666"}   
             ]   
     }   
       
     alert(user.username);   
     alert(user.age);   
     alert(user.info.cellphone);   
     alert(user.address[0].city);   
     alert(user.address[0].postcode);   
}   
Õâ±íʾһ¸öuser¶ÔÏó£¬ÓµÓÐusername, age, info, address µÈÊôÐÔ¡£
ͬÑùÒ²¿ÉÒÔÓÃJSONÀ´¼òµ¥µÄÐÞ¸Ä


Ïà¹ØÎĵµ£º

ͨ¹ýjavascript»ñµÃurl²ÎÊý

Ò³ÃæÌá½»Êý¾ÝÒ»°ãÓÐÁ½ÖÖ·½·¨£ºget,post¡£post¾ÍÊÇËùνµÄformÌá½»£¬Ê¹ÓÃÊÓͼ£»getÊÇͨ¹ýurlÌá½»¡£
Get·½·¨Ò»°ãÓúǫ́´úÂ루Èçasp,asp.net£©»ñµÃ²ÎÊý£¬´úÂëºÜ¼òµ¥£ºRequest.QueryString["id"];¼´¿É»ñÈ¡¡£ 
ÓÐЩʱºòÐèÒªÖ±½ÓÔÚǰ̨»ñÈ¡url²ÎÊý£¬ÒªÓõ½javascript£¬jsûÓÐÖ±½Ó»ñÈ¡url²ÎÊýµÄ·½·¨£¬ÄÇô£¬ÎÒÃÇÈçºÎͨ¹ýjs ......

£¨×ª£©javascript ÄÚ´æй¶¹¤¾ßʹÓÃ


javascriptÄÚ´æ鶵ÄÎÊÌâÒ»Ö±ÒÔÀ´¶¼²»Êܵ½´ó¼ÒµÄÖØÊÓ£¬Ô­ÒòÊǶÔÓû§µÄÓ°ÏìûÓÐ̫ʵ¼ÊµÄ±íÏÖ£¬»òÐí½ü¼¸ÄêÄڴ淢չѸËÙ¡£½Å±¾ÄÚ´æÔÙй¶Ҳ²»»áÓÐÌ«´óÓ°Ïì¡£
µ±È»×÷Ϊǰ¶Ë¿ª·¢µÄͬѧÃÇ£¬¾Í²»ÄÜÓÐÕâÑùµÄ½ÄÐÒÐÄÀí¡£³öÏÖmemory leaksºÜ´ó³Ì¶ÈÉÏÊÇÒòΪ³ÌÐòµÄ²»³ÉÊìºÍ±àÂ벻̫¹æ·¶Ôì³ÉµÄ¡£²»¹ý£¬ÕâÀï¾Í²»ËµÈçºÎ³öÏÖÎÊÌâµÄ£¬¶ÔÎÊ ......

JavascriptÃæÏò¶ÔÏó±à³Ì£¨Èý£©£º·Çº¯Êý¶ÔÏóµÄ¼Ì³Ð


×òÌ죬ÎÒ±¾À´´òË㣬°ÑÕâ¸ö»°Ìâ½áÊøÁË¡£
µ«ÊÇ£¬Ð´µ½Ò»°ëµÄʱºò£¬ÎÒͻȻÒâʶµ½£¬JavascriptµÄ¼Ì³ÐÓÐÁ½ÖÖ¡£Ò»ÖÖÊÇ»ùÓÚ"º¯Êý¶ÔÏó"µÄ¼Ì³Ð£¬Ò²¾ÍÊÇÒ»¸öfunctionÈ¥¼Ì³ÐÁíÍâÒ»¸öfunction£¬Õâ¸öÎÒÒѾ­ÔÚ×òÌì½éÉܹýÁË¡£
ÁíÒ»ÖÖÔòÊÇ»ùÓÚ"·Çº¯Êý¶ÔÏó"µÄ¼Ì³Ð£¬²»Éæ¼°function¡£ËüµÄ×ö·¨ÓëÇ°Ò»ÖÖÇé¿öÍêÈ«²»Í¬¡£
Ò»¡¢Ê²Ã´ÊÇ"·Çº¯Êý¶ÔÏ ......

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

// µ÷ÓÃÒ³ÃæµÄˢз½·¨
     IHTMLWindow2* pWindow;
     IHTMLDocument2*   pDocument; 
     HRESULT hr = GetDHtmlDocument(&pDocument);  
     hr = pDocument->get_pa ......

JavaScript:history.go() µÄÃîÓÃ(ת)

  ÔÚWeb¿ª·¢ÖУ¬»áÓöµ½´ÓÒ»Ò³£¨¸¸Ò³£©µ¼ÏòÁíÒ»Ò³£¨×ÓÒ³£©£¬²¢ÇÒÒªÇó“·µ»Ø”¸¸Ò³µÄÇé¿ö£¬ÔÚÕâÀïÈç¹ûÓÃASP.NETÌṩµÄ Response.Redirect()·½·¨£¬ÍùÍù²»»á´ïµ½ÀíÏëµÄЧ¹û£¬ÀýÈ磺·µ»Øºó£¬ÖØмÓÔØÁËÒ³Ã棬ÎÞ·¨±£´æµ¼Ïò×ÓҳǰµÄ״̬£¬µÈµÈ£¬ÔÚÕâÀïÎҾͽéÉÜ Ò»ÏÂÈçºÎʹÓÃJavaScriptÖÐhistory.go()º¯ÊýÀ´ÊµÏÖ·µ»Ø ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ