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

ÔÚjavascript ÖÐʹÓÃJSON

ÒòΪJSON ÊÇ javascript µÄÒ»¸ö×Ó¼¯£¬ËùÒÔ£¬ÔÚjavascript ÖÐʹÓÃJSONÊǷdz£¼òµ¥µÄ¡£
   
   
js ´úÂë
 
var myJSONObject = {"bindings": [  
        {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},  
        {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},  
        {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}  
    ]  
};  
ÔÚÉÏÃæµÄÀý×ÓÖУ¬ÎÒÃÇ´´½¨ÁËÖ»°üº¬Ò»¸ö³ÉÔ± "bindings" µÄÒ»¸ö¶ÔÏó£¬bindings Ôò°üº¬ÁËÒ»¸öÓÉ3¸ö¶ÔÏó×é³ÉµÄÊý×é¡£Õâ3¸ö¶ÔÏ󶼰üº¬3¸ö³ÉÔ±£º"ircEvent"£¬ "method"£¬"regex"¡£
ÔÚjavascript ÖУ¬ ³ÉÔ±¿ÉÒÔͨ¹ý“µãºÅ”À´»ñÈ¡¡£
±ÈÈ磺
JSON ½âÎöÆ÷¡£ Ò»¸ö JSON ½âÎöÆ÷½«Ö»½ÓÊÜ JSON Îı¾¡£ËùÒÔÊǸü°²È«µÄ¡£
js ´úÂë
myJSONObject.bindings[0].method  
ͨ¹ýeval() º¯Êý¿ÉÒÔ½«JSON×Ö·û´®×ª»¯Îª¶ÔÏó¡£
js ´úÂë
var myObject = eval('(' + myJSONtext + ')');  
eval º¯Êý·Ç³£¿ì£¬µ«ÊÇËü¿ÉÒÔ±àÒëÈκΠjavascirpt ´úÂ룬ÕâÑùµÄ»°¾Í¿ÉÄܲúÉú°²È«µÄÎÊÌâ¡£eval µÄʹÓÃÊÇ»ùÓÚ´«ÈëµÄ´úÂë²ÎÊýÊÇ¿É¿¿µÄ¼ÙÉèµÄ£¬ÓÐһЩÇé¿öÏ£¬¿ÉÄÜ¿Í»§¶ËÊDz»¿ÉÐÅÈεġ£
Èç¹û»ùÓÚ°²È«µÄ¿¼ÂǵĻ°£¬×îºÃÊÇʹÓÃÒ»¸ö
js ´úÂë
 
var myObject = JSON.parse(myJSONtext, filter);  
¿ÉÑ¡µÄ filter ²ÎÊý½«±éÀúÿһ¸övalue key Öµ¶Ô£¬ ²¢½øÐÐÏà¹ØµÄ´¦Àí¡£È磺
stringifier º¯ÊýµÄ×÷Óøú parse Ïà·´£¬ ÓÃÀ´½«Ò»¸öjs¶ÔÏóת»»Îª JSON Îı¾¡£
js ´úÂë
myData = JSON.parse(text, function (key, value) {       
return key.indexOf('date') >= 0 ? new Date(value) : value;    }); 
js ´úÂë
var myJSONText = JSON.strin


Ïà¹ØÎĵµ£º

javascript ¸÷Öֵõ½ä¯ÀÀÆ÷¿í¶ÈºÍ¸ß¶ÈµÄº¯Êý

function getInfo()
{
    var s = "";
    s += " ÍøÒ³¿É¼ûÇøÓò¿í£º"+ document.body.clientWidth+"\n";
    s += " ÍøÒ³¿É¼ûÇøÓò¸ß£º"+ document.body.clientHeight+"\n";
    s += " ÍøÒ³¿É¼ ......

³£¼ûfirefox²»Ö§³ÖµÄJavaScriptÎÊÌâ

<a href="#" onclick="ChildNode(this);">aaa</a>Òª¸ÄΪ
<a href="#" onclick="ChildNode(event);">aaa</a>
ÎÞ·¨È¡µÃthis¶ÔÏó£¬ÒªÓÃÒÔÏ·½·¨À´È¡µÃ¡£
function ChildNode(e)
{
var evt = e ? e : (window.event ? window.event : null); //´Ë·½·¨ÎªÁËÔÚfirefoxÖеļæÈÝ
var node = evt.srcEl ......

ÎÞ·ì¹ö¶¯ÐÂÎŵÄJavascriptÔ´´úÂë

ÖصãÔÚÓÚfunction scroll()£¬function clipShow()¼°ÒÔÏÂforÑ­»·¡£
ÎÞ·ì¹ö¶¯ÐÂÎŵÄJavascriptÔ´´úÂ룬·ÅÔÚÕâÀÓÐÐèÒªµÄʱºò¿ÉÄÜÓõÃÉÏ£º
//CSSÑùʽ
<style>
.new_newsT{
 padding-top: 10px;
 padding-bottom: 8px;
}
.new_newsT  .list {
 CLEAR: both; MARGIN: 0px 6px 0px 10px
} ......

ÓÃCSS+JavaScriptʵÏÖÎÄ×ÖÉÁ˸Ч¹û

1. CSS
<style>
.dstyle1 {
font-size:13px;
font-weight: bold;
color: #ff6600;
}
.dstyle2 {
font-size:13px;
font-weight: bold;
color: #ffffff;
}
</style>
2. JavaScript
<script type="text/javascript">
m();
function m()
{
document.getElementById("span_new").classNa ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ