a.html 与 a.js ,juery 简单练习

来源:互联网 发布:linux squid 启动 编辑:程序博客网 时间:2024/05/01 04:46

a.html

<!doctype html><html>    <head>        <title>123</title>        <meta charset="UTF-8" />        <style>            span {                color:red;            }            .red_text {                color:yellow;            }            #red_text2 {                color:yellow;            }            .big_font {                font-size: 100px;                font-family: monospace;            }            .yellow_text {                color:yellow;            }            p {                background: gray;                color:green;            }            #left {                border: solid;                float:right;            }            #right {                clear:both;                float:right;                border: solid;            }        </style>    </head>    <body>    <div id="container">        <div id="left">        <p>        I <span id="red_text">am</span> <span class="yellow_text">good</span>        </p>        <p>        I <span class="red_text big_font">am</span> <span class="yellow_text">good</span>        </p>        <script>            var func = function(){                alert('clicked!');            }            func()        </script>        </div>            <img src="http://avatar.csdn.net/A/0/F/1_robby_chan.jpg">        <div id="right">        this is right        <button id="btn_a">一个</button>        </div>    </div>    </body></html>

a.js

var city = "beijing";$.getJSON(    "http://mytest.qunar.com:8080/hotelReconf/apiCity?cityUrl="+city,    function(json){        var imgUrl = json[0]["imgUrl"];        var toUrl = json[0]["toUrl"];        var name = json[0]["name"];        console.log(imgUrl);    });

Learn from xxu



0 0