zoukankan      html  css  js  c++  java
  • 吴裕雄--天生自然WEB前端开发实战--Ajax

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <title>JSON</title>
            <script>
                //遍历JSON对象
                var myJson = { 'name' : '刘兵' , 'age' : 18  };
                for( var key in myJson ){
                    document.write( key+' : '+myJson[key]+"<br>" );  
                }
                //遍历JSON数组
                var wqJson = [    {'name':'张三','age':19},
                                {'name':'李四','age':20},
                                {'name':'王五','age':21},
                            ]
                for(var i =0;i<wqJson.length;i++){
                    for(var j in wqJson[i]){
                        document.write(j+":"+wqJson[i][j]+"<br>")
                    }
                }
            </script>
        </head>
        <body>
          
        </body>
        </html>
    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <title>JSON</title>
            <script>
                //遍历JSON对象
                var myJson = { 'name' : '刘兵' , 'age' : 18  };
                for( var key in myJson ){
                    document.write( key+' : '+myJson[key]+"<br>" );  
                }
                //遍历JSON数组
                var wqJson = [    {'name':'张三','age':19},
                                {'name':'李四','age':20},
                                {'name':'王五','age':21},
                            ]
                for(var i =0;i<wqJson.length;i++){
                    for(var j in wqJson[i]){
                        document.write(j+":"+wqJson[i][j]+"<br>")
                    }
                }
            </script>
        </head>
        <body>
          
        </body>
        </html>
    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <title>JSON</title>
            <script>
                //遍历JSON对象
                var myJson = { 'name' : '刘兵' , 'age' : 18  };
                for( var key in myJson ){
                    document.write( key+' : '+myJson[key]+"<br>" );  
                }
                //遍历JSON数组
                var wqJson = [    {'name':'张三','age':19},
                                {'name':'李四','age':20},
                                {'name':'王五','age':21},
                            ]
                for(var i =0;i<wqJson.length;i++){
                    for(var j in wqJson[i]){
                        document.write(j+":"+wqJson[i][j]+"<br>")
                    }
                }
            </script>
        </head>
        <body>
          
        </body>
        </html>
  • 相关阅读:
    input上传限定文件类型
    扫描二维码自动识别手机系统(Android/IOS)
    css/html/Javascript
    移动端容易碰到的点击穿透的坑
    洛谷P3387 【模板】缩点
    洛谷P1137 旅行计划
    洛谷P2324 [SCOI2005]骑士精神
    洛谷P2571 [SCOI2010]传送带
    BZOJ4300: 绝世好题
    [洛谷P1966] 火柴排队
  • 原文地址:https://www.cnblogs.com/tszr/p/13870883.html
Copyright © 2011-2022 走看看