<!DOCTYPE html><html>? ? <head>? ? ? ? <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />? ? ? ? <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>? ? ? ? <title>挑戰(zhàn)題</title>? ? </head>? ? <body>? ? ? ? <button id="seach">查詢成績(jī)</button></br>? ? ? ? <div></div>? ? ? ? ?<script> ??? ? ? ? ? ? $(function(){? ? ? ? ? ? ? ? ? ?var json=[? ? ? ? ? ? ? ? ? ? {"name":"小明","score":"70"},? ? ? ? ? ? ? ? ? ? {"name":"小紅","score":"80"},? ? ? ? ? ? ? ? ? ? {"name":"小藍(lán)","score":"50"},? ? ? ? ? ? ? ? ? ? {"name":"小白","score":"20"} ?? ? ? ? ? ? ? ? ? ? ];? ? ? ? ? ? ? ? ? ? $("#seach").bind("click",function(){? ? ? ? ? ? ? ? ? ? ? ? $("div").empty();? ? ? ? ? ? ? ? ? ? ? ? $.each(json,function(index,data){? ? ? ? ? ? ? ? ? ? ? ? ? ? $("div").append("<p>姓名:" + data.name + ",成績(jī):" + data.score + "</p>")? ? ? ? ? ? ? ? ? ? ? ? })? ? ? ? ? ? ? ? ? ? })? ? ? ? ? ? ? ? })? ? ? ? </script>? ? </body></html>
為什么我的代碼不起作用呢?
Xerxus
2016-03-31 10:27:27