(016)json使用

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>json使用</title>
    <script type="text/javascript">

        var obj = {a:1,b:2,c:'abc'};
        //alert(obj.a);
        //alert(obj.b);
        //alert(obj.c);

        var arr = [{a:1,b:2},{a:3,b:4}];
        //alert(arr[0].a);
        var attr = '';
        for(attr in obj)
        {
            alert(attr + "=" obj[attr]);
        }
        
    </script>
</head>

<body>
    
</body>
</html>

 

posted @ 2014-01-21 23:47  雪中飞雁  阅读(80)  评论(0)    收藏  举报