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>

  • 相关阅读:
    asp.net自己创建的app_code文件夹中的类不能访问的解决办法
    html+css实现选项卡功能 【转】
    jquery实现文本框数量加减功能的例子分享
    css3中的background
    通过CSS3 实现响应式Web设计的三个步骤
    鼠标移动到图片透明度改变
    jQuery之简单的表单验证【转】
    手机web——自适应网页设计(html/css控制)【转】
    css3 media媒体查询器用法总结
    把人团结在一起的力量
  • 原文地址:https://www.cnblogs.com/shenjun/p/3092588.html
Copyright © 2011-2022 走看看