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

JavaScriptÖеÄJSON

 
JavaScriptÖеÄJSON
 
JavaScriptÊÇΪÍø¾°ä¯ÀÀÆ÷×öÒ³Ãæ½Å±¾ÓïÑÔ¶øʵÏÖµÄÒ»ÖÖ±à³ÌÓïÑÔ¡£ËüÏÖÔÚ»¹±»ºÜ¶àÈËÎó½âÊÇjavaµÄ×Ó¼¯¡£ËüÊÇÒ»ÖÖ¾ßÓÐÀàCÓï·¨ºÍÈõ¶ÔÏóµÄģʽÓïÑÔ¡£JavaScriptÍêÈ«×ñÊØECMAScriptÓïÑÔ˵Ã÷ÊéµÚÈý°æ¡£
JSONÊÇJavaScript¶ÔÏóÎÄ×ּǺŵÄ×Ó¼¯¡£ÓÉÓÚJSONÊÇJavaSriptµÄ×Ó¼¯£¬ËùÒÔÔÚJavaScriptÀ¿ÉÒÔ·½±ãµÄÓ¦¸ÃJSON¡£
var myJSONObject = {"bindings": [
        {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},
        {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},
        {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}
    ]
};
ÔÚÕâ¸öÀý×ÓÀïÃ棬´´½¨Ò»¸öµ¥¶ÀµÄ³ÉÔ±——“bindings”£¬Õâ¸ö³ÉÔ±Àï°üº¬Ò»¸öÓÐÈý¸ö¶ÔÏó——“ircEvent”, “method”ºÍ“regex”µÄ¶ÔÏóÊý×é¡£
Êý¾Ý¿ÉÒÔÓöººÅ£¨£¬£©»òÕßϱê·û£¬Àý£º
myJSONObject.bindings[0].method    // "newURI"
Äú¿ÉÐÄÓÃeval()°ÑJSONÖеÄÊý¾Ýת»¯Îª¶ÔÏó¡£ Eval()¿ÉÒÔµ÷ÓÃjavascript±àÒëÆ÷¡£ÓÉÓÚJSONÊÇJavaScriptµÄ×Ó¼¯£¬±àÒëÆ÷¿ÉÒÔÕýÈ·µÄ°ÑÎı¾×ª»¯Îª¶ÔÏó½á¹¹¡£Õâ¸ö×ֶαØÐëÊÇ°üÔÚ¸¸µÄÓï·¨Öеģ¬±ÜÃâÔÚJavaScriptµÄÓ﷨ϲúÉú¶þÒâÐÔ¡£
       var myObject = eval('(' + myJSONtext + ')');
       Õâ¾ßevalº¯ÊýÔËÐзdz£¿ì£¬µ«ËüÄܱàÒëºÍÔËÐÐÈκÎJavaScript³ÌÐò£¬Òò´ËÓÐÒ»¶¨µÄ°²È«Òþ»¼¡£µ±Ô´´úÂëÊÇ¿ÉÐÅÈβ¢ÇÒºÏÊʵÄʱºò£¬evalµÄÓ÷¨ÊÇÍêÈ«¿ÉÒԵġ£EÓÃJSONÆÊÎöÆ÷¸ü¼Ó°²È«¡£ÔÚXMLHttpRequestµÄÍøÒ³Ó¦ÓóÌÐòÖУ¬Ö»ÓÐÏàͬµÄÔ´³ÌÐòÌṩҳÃæ±»ÔÊÐí£¬Òò´ËËüÊÇ¿ÉÐŵġ£µ«ËüÒ²Óв»¿ÉÒÔµÄʱºò£ºÈç¹û·þÎñÆ÷ÔÚJSON±àÂëÉϲ»ÑÏÃÜ»òÕßËüûÓÐÈ«²¿Ö¤ÊµËüµÄËùÓÐÊäÈëµÄ»°£¬Ëü¿ÉÄÜ·¢ËÍ´øÓÐΣÏսű¾µÄ²»ºÏ·¨JSONÎı¾¡£¶øevalº¯ÊýÄÜÔËÐÐÕâ¸ö½Å±¾£¬ÊͷųöΣÏÕ¡£
       ÓÃJSON½âÎöÆ÷¾ÍÄÜ·ÀÖ¹ÕâÖÖÊÂÇ飬JSON½âÎöÆ÷Ö»ÈÏJSONÄÚÈÝ£¬²»ÈÏ×÷±£½Å±¾¡£ÔÚÖ§³ÖJSONµÄä¯ÀÀÆ÷ÖУ¬JSON½âÎöÆ÷±Èeval¿ì¶àÁË£¬ÆÚÍûÔÚECMAScript±ê×¼µÄÏÂÒ»¸ö°æ±¾Öлá°üº¬¶Ô±¾µØJSONµÄÖ§³Ö¡£
var myObject = JSON.parse(myJSONtex


Ïà¹ØÎĵµ£º

JavaScript ¹¹Ô캯Êý myhere

/**
* JavaScript ÊÇÃæÏò¶ÔÏóµÄÓïÑÔ£¬µ«ÊÇËûµÄÃæÏò¶ÔÏó²»ÊÇ»ùÓÚÀàµÄ£¬ÊÇ»ùÓÚÔ­Ð͵Ä;
* µ«ÊÇËûµÄһЩÌØÐÔ(º¯ÊýÊÇÊý¾Ý)£¬Ê¹µÃËü¿ÉÒÔÄ£Äâ»ùÓÚÀàµÄÃæÏò¶ÔÏ󣬵«ÊÇ JavaScript ²¢²»Ö§³ÖºÍ Java Ò»ÑùµÄÀ࣬
* Òò´Ë JavaScript ÖеÄ"Àà"¿ÉÒÔ³Æ×÷"αÀà"
*/
//
/**
* ¹¹Ô캯Êý: js ÖÐÓÃÀ´ºÍ new ÔËËã·ûÒ»ÆðʹÓõĺ¯Êý³Æ× ......

JavaScript ´´½¨Àà/¶ÔÏóµÄ¼¸ÖÖ·½Ê½

ÔÚJSÖУ¬´´½¨¶ÔÏó£¨Create Object£©²¢²»ÍêÈ«ÊÇÎÒÃÇʱ³£ËµµÄ´´½¨Àà¶ÔÏó£¬JSÖеĶÔÏóÇ¿µ÷µÄÊÇÒ»ÖÖ¸´ºÏÀàÐÍ£¬JSÖд´½¨¶ÔÏó¼°¶Ô¶ÔÏóµÄ·ÃÎÊÊǼ«ÆäÁé»îµÄ¡£
JS¶ÔÏóÊÇÒ»ÖÖ¸´ºÏÀàÐÍ£¬ËüÔÊÐíÄãͨ¹ý±äÁ¿Ãû´æ´¢ºÍ·ÃÎÊ£¬»»Ò»ÖÖ˼·£¬¶ÔÏóÊÇÒ»¸öÎÞÐòµÄÊôÐÔ¼¯ºÏ£¬¼¯ºÏÖеÄÿһÏÓÉÃû³ÆºÍÖµ×é³É£¨ÌýÆðÀ´ÊDz»ÊǺÜÏñÎÒÃdz£Ìý˵µÄHASH±í¡¢× ......

javascript³£ÓÃ

calcu()  ----º¯ÊýʵÏÖÁ½¸öÊýÏà³Ë
document.write();  ---´òÓ¡
document.calc.ÔªËØÃû.value;  --»ñµÃ±íµ¥µÄÖµ
document.±íµ¥Ãû¡£±íµ¥ÔªËØÃû¡£value  Ϊ±íµ¥¸³Öµ
¶¨Ò庯Êý£º
 function  Ãû×Ö()
 {
    //javaScriptÔ¤Óï¾ä
 }
 onClick="º¯ÊýÃû";  ......

[·­Òë]High Performance JavaScript(005)

µÚ¶þÕ  Data Access  Êý¾Ý·ÃÎÊ
    One of the classic computer science problems is determining where data should be stored for optimal reading and writing. Where data is stored is related to how quickly it can be retrieved during code execution. This problem in JavaScri ......

¼ÙÈçä¯ÀÀÆ÷À뿪ÁËJavaScript [ µËÙ© ] ÓÚ:2009 05 10


¼ÙÈçä¯ÀÀÆ÷À뿪ÁËJavaScript
¼ÙÈçä¯ÀÀÆ÷À뿪ÁË JavaScript£¬ÄÇô»¥ÁªÍøÉϾø´ó¶àÊýÍøÒ³¾ÍÎÞ·¨Õ¹Ê¾¡£µ«ÊǼ¤½øµÄÖ÷ÕŲ¢·ÇÒ»ÎÞÊÇ´¦£¬ÖÁÉÙËüÄÜ·ñ´Ù½øÎÒÃǶÔÊìÊÓÎ޶õÄÊÂÎ»»Ò»¸ö½Ç¶È×ö½øÒ»²½Ë¼¿¼¡£¼ÙÈçÓÃJavaÌæ»»JavaScript£¬»áÓÐʲôºÃ´¦£¿ºÃ´¦»òÐíÓÐÈý¸ö²ãÃ棬¶ÔÓÚÊÖ»úÓ¦ÓöøÑÔ£¬ÕâЩÓŵãÓÈÆä¿É¹ó¡£
1. Ô¤ÏȱàÒ룬ʼþÏì ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ