zoukankan      html  css  js  c++  java
  • extJSjson字符串和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>无标题文档</title>
    <link rel="stylesheet" type="text/css" href="ext-all.css" />

    <script type="text/javascript" src="ext-base.js"></script>
    <script type="text/javascript" src="ext-all.js"></script>
    <script type="text/javascript" src="json.js"></script>
    <script type="text/javascript" src="Charts.js"></script>
    <script type="text/javascript">
    /*注意js脚本文件的引入顺序*/

    Ext.onReady(function(){

    Ext.MessageBox.alert("订单","放放风");

    });
    var jsonstr = '{"people":[{"id":"123"},{"id":"124"}]}';//json字符串

     alert(JSON.parse(jsonstr).people[1].id);
    alert(JSON.stringify(jsonstr))

    //showJSON();
    function showJSON() {       
        
    var user =     //json对象   
        {        
            "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);       
    }     


    </script>

    </head>

    <body>
    </body>
    </html>

  • 相关阅读:
    JNI实例(含代码)
    sizeof()小结
    【转】C++ 关键字——friend
    curl资料小结
    【Curl (libcurl) 开发 之一】Cocos2dx之libcurl(curl_easy)的编程教程(帮助手册)!
    JSP中统一错误信息输出
    在号码池取连续号码的算法
    常用的文件操作方法
    走出基金净值的误区
    ResultSet概论
  • 原文地址:https://www.cnblogs.com/shenjun/p/3092588.html
Copyright © 2011-2022 走看看