第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

老哥們,請(qǐng)求指導(dǎo)一下代碼哪里錯(cuò)了?

<!DOCTYPE?html>
<html>
????<head>
????????<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/>
????????<title>挑戰(zhàn)題</title>
????</head>
????<body>
????????<div><input?id="btnShow"?type="button"?value="加載學(xué)生信息"/></div>
????????<ul></ul>
????????<script>
????????????var?source=[{'name':'kayber'},
????????????????????????{'age':'18'},
????????????????????????{'sex':'male'},
????????????????????????{'score':'100'}
???????????????????????];
????????????$("#btnShow").bind("click",function(){
????????????????$.each(source,function(index,sport){
????????????????????$("ul").append("<li>姓名:"+sport.name+"</li><li>年齡:"+sport.age+"</li><li>性別:"+sport.sex+"</li><li>分?jǐn)?shù):"+sport.score+"</li>")
????????????????})
????????????})
????????????
????????</script>
????????
????</body>
</html>


正在回答

4 回答

<!DOCTYPE html>
<html>
??? <head>
??????? <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
??????? <title>挑戰(zhàn)題</title>
??????? <script src="http://libs.baidu.com/jquery/1.8.2/jquery.js" type="text/javascript"></script>
??? </head>
??? <body>
??????? <div><input id="btnShow" type="button" value="加載學(xué)生信息"/></div>
??????? <ul></ul>
??????? <script type="text/javascript">
?? ??? ?//用JSON語(yǔ)法定義對(duì)象source
??????????? var source={name:'kayber',
??????????????????????? age:'18',
??????????????????????? sex:'male',
??????????????????????? score:'100'};
?? ??? ?//文檔加載完畢執(zhí)行
?? ?$(function(){
??????????? $("#btnShow").bind("click",function(){
?? ??? ??? ??? ?//定義一個(gè)數(shù)組,取出JSON對(duì)象數(shù)據(jù)
?? ??? ??? ??? ?var arr=new Array();
??????????????? $.each(source,function(index,sport){
?? ??? ??? ??? ??? ?//將遍歷數(shù)據(jù)放入數(shù)組
?? ??? ??? ??? ??? ?arr[index]=sport;
?????????????????? ?
??????????????? });//each結(jié)束
?? ??? ??? ??? ?//將數(shù)組內(nèi)容放入文檔
?? ??? ??? ??? ?$("ul").append("<li>姓名:"+arr['name']+"</li><li>年齡:"+arr['age']+"</li><li>性別:"+arr['sex']+"</li><li>分?jǐn)?shù):"+arr['score']+"</li>");
??????????? });//bind結(jié)束
?? ??? ??? ??? ??? ??? ?});//$()結(jié)束
??????????? ?
??????? </script>
??????? ?
??? </body>
</html>

1 回復(fù) 有任何疑惑可以回復(fù)我~
#1

Kayber 提問(wèn)者

多謝!
2017-08-04 回復(fù) 有任何疑惑可以回復(fù)我~
#2

Kayber 提問(wèn)者

不是很了解Json對(duì)象數(shù)據(jù),,,是不是json對(duì)象數(shù)據(jù)都要轉(zhuǎn)成數(shù)組才可以使用呢?
2017-08-04 回復(fù) 有任何疑惑可以回復(fù)我~
#3

慕后端3084738 回復(fù) Kayber 提問(wèn)者

不一定要轉(zhuǎn)數(shù)組
2017-10-08 回復(fù) 有任何疑惑可以回復(fù)我~

錯(cuò)的太多,等我給你改一下



0 回復(fù) 有任何疑惑可以回復(fù)我~

<script src="http://libs.baidu.com/jquery/1.8.2/jquery.js" type="text/javascript"></script>

放入head里面

0 回復(fù) 有任何疑惑可以回復(fù)我~

沒(méi)有引入jquery,^_^

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

老哥們,請(qǐng)求指導(dǎo)一下代碼哪里錯(cuò)了?

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)