¡¶Îò͸javascript¡·Ñ§Ï°±Ê¼Ç£ºÆß¡¢¶ÔÏóÃèÊö
ÒýÑÔ
ÔÚJavaScriptÖÐÎÒÃÇʹÓÃÁËÒ»ÖÖ±»³ÆÎª JavaScript Object Notation(ËõдJSON)µÄÐÎʽ£¬·ÒëΪÖÐÎľÍÊÇ“JavaScript¶ÔÏó±íʾ·¨”¡£Ëü¿ÉÒÔ¼ò½éÇåÎúµØ½«¶ÔÏóµÄ½á¹¹ÃèÊö³öÀ´£¬´Ó¶ø´ó´ó½µµÍÁËÎÒÃǵŤ×÷Á¿²¢¼õÉÙÁËÊý¾ÝÁ¿¡£
JsonʾÀý
<script language="javascript">
//´´½¨Ò»¸öûÓÐÈκÎÊôÐԵĶÔÏó
var o = {}
//´´½¨Ò»¸ö¶ÔÏó,²¢ÉèÖÃÊôÐԺͳõʼֵ
var person = {name:"myname", age:24, married:true}
//¸´ÔÓ¶ÔÏó
var company = {
name : "MicroSoft",
boss : {name:"BillGates", age:55},
employees : [{name:"eeA", age:30},{name:"eeB", age:33}],
readme : function(){alert(this.name + "'s boss is " + this.boss.name);}
}
company.readme();
</script>
Json¹æÔò
Æäʵ´ÓÉÏÃæµÄÀý×ӾͿÉÒÔ×ܽá³öjsonµÄ¹æÔòÁË£¬jsonÆäʵ¾ÍÊǼüÖµ¶ÔµÄ¼¯ºÏ£¬ÈçÏ£º
1. ¼üÖµ¶Ô¼¯ºÏ±ØÐëÔÚ´óÀ¨ºÅÖ®¼ä£¬È磺{…}
2. ¼üÖµÖ®¼äʹÓÃðºÅ·Ö¸ô£¬È磺name:”myName”
3. ¼üÖµ¶ÔÖ®¼äʹÓöººÅ·Ö¸ô£¬È磺name:”myName”, age:23
4. Èç¹ûÊÇÊý×éµÄ»°Ê¹ÓÃÖÐÀ¨ºÅ£¬È磺[{name:”haha”, age:21},{name:”myName”, age:23}]
Ïà¹ØÎĵµ£º
Ò»¡¢ºǫ́£¨.csÎļþ£©·½·¨£º
public string GetString(string name)
{
return ("Hello " + name);
}
&n ......
JavaScriptʼþ·ÖÀࣺ
1¡¢²¶»ñÐÍ£¨IE²»Ö§³Ö£©£¨´ÓDOM½á¹¹µÄ×î¶¥¶Ë¿ªÊ¼ÏòÏÂÑÓÉ죩
2¡¢Ã°ÅÝÐÍ£¨´ÓDOM½á¹¹µÄ×îµÍ¶ËÏòÉÏÒ»¼¶¼¶ÑÓÉ죩
¡¾IE7ÒÔÉÏ¿ÉÒÔ¸ø‘html’Ìí¼Óonclickʼþ£¬IEÖÐbody->html£¬»ðºüÖÐhtml->body¡¿
JavaScriptÌí¼Óʼþ¼àÌý£º
1¡¢IE£º
[object].attachEvent("event_handler", fnHandler); ......
response.write "<script language='javascript'>"
response.write "alert('Óû§Ãû»òÃÜÂë´íÎó!');"
response.write "hist ......
ÒýÑÔ
ÒªÀí½â JavaScript£¬ÄãµÃÊ×ÏÈ·Å϶ÔÏóºÍÀàµÄ¸ÅÄ»Øµ½Êý¾ÝºÍ´úÂëµÄ±¾Ô¡£Ç°ÃæËµ¹ý£¬±à³ÌÊÀ½çÖ»ÓÐÊý¾ÝºÍ´úÂëÁ½ÖÖ»ù±¾ÔªËØ£¬¶øÕâÁ½ÖÖÔªËØÓÖÓÐמÀ²ø²»ÇåµÄ¹ØÏµ¡£JavaScript¾ÍÊǰÑÊý¾ÝºÍ´úÂë¶¼¼ò»¯µ½×îÔʼµÄ³Ì¶È¡£
»ù±¾ÀàÐÍ
Ò»¡¢¼òµ¥Êý¾ÝÀàÐÍ£ºundefined¡¢null¡¢boolean¡¢number¡¢string£¨×¢Ò⣺¶¼Ê ......
ÒýÑÔ
ÈκÎÒ»¸öº¯Êý¶¼¿ÉÒÔΪÆä¶¯Ì¬µØÌí¼Ó»òÈ¥³ýÊôÐÔ£¬ÕâЩÊôÐÔ¿ÉÒÔÊǼòµ¥ÀàÐÍ£¬¿ÉÒÔÊǶÔÏó£¬Ò²¿ÉÒÔÊÇÆäËûº¯Êý¡£Ò²¾ÍÊÇ˵£¬º¯Êý¾ßÓжÔÏóµÄÈ«²¿ÌØÕ÷£¬ÄãÍêÈ«¿ÉÒ԰Ѻ¯Êýµ±¶ÔÏóÀ´Óá£Æäʵ£¬º¯Êý¾ÍÊǶÔÏó£¬Ö»²»¹ý±ÈÒ»°ãµÄ¶ÔÏó¶àÁËÒ»¸öÀ¨ºÅ“()”²Ù×÷·û£¬Õâ¸ö²Ù×÷·ûÓÃÀ´Ö´Ðк¯ÊýµÄÂß¼¡£¼´£¬º¯Êý±¾Éí»¹¿ÉÒÔ±»µ÷ ......