91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

json數據格式

發布時間:2020-06-29 10:54:30 來源:網絡 閱讀:554 作者:yixiaoqun 欄目:web開發

JSON數據格式

ex01

<scriptlanguage="JavaScript">

/*

*類對象,封閉成員屬性

*classPeople{

*Stringfirstname

*Stringlastname

*Stringemail

*}

*

*Peoplepeople=newPeople();

*

*people.firstname

*people.lastname

*people.email

*

*/

/*

*json格式表示一個對象,鍵值相對

*格式:{key01:value01,key02:value02}

*

*/

varpeople={"firstname":"zhang","lastname":"sanfeng","email":"keni@com"}

//alert("people"+people)

//alert("people")

////輸出peopelfirst屬性的值,zhang

alert(":"+people.firstname);

//輸出peopellastname屬性的值,sanfeng

alert(":"+people.lastname);

//輸出peopelemail屬性的值,keni@com

alert("電子郵箱:"+people.email);

</script>

ex02

<scriptlanguage="JavaScript">

/*

*json格式表示一個對象

*格式:[

*{key01:value01,key02:value02},

*{key01:value01,key02:value02}

*]

*

*/

//json數組集合,存放兩個對象,每個對象有三個屬性

varpeople=[

{"firstname":"zhang1","lastname":"sanfeng1","email":"keni1@com"},

{"firstname":"zhang2","lastname":"sanfeng2","email":"keni2@com"}

]

alert("對象長度"+people.length);//長度為2

//輸出對象數組中第二個對象的lastname屬性

alert("第二個對象的lastname屬性:"+people[1].lastname);//輸出zhang2

</script>

ex03

<scriptlanguage="JavaScript">

/*

*json格式表示一個對象

*格式:{key:

*[

*{key01:value01,key02:value02},

*{key01:value01,key02:value02}

*]

*}

*

*/

varpeople={"program":

[

{"firstname":"zhang1","lastname":"sanfeng1","email":"keni1@com"},

{"firstname":"zhang2","lastname":"sanfeng2","email":"keni2@com"}

]

}

alert(people.program.length);//輸出program的長度為2

alert(people.program[1].lastname);//輸出people對象中program屬性中第二個對象的lastname

</script>

ex04

<scriptlanguage="JavaScript">

/*

*json格式表示一個對象

*格式:{key1:

*[

*{key01:value01,key02:value02},

*{key01:value01,key02:value02}

*],

*key2:

*[

*{key01:value01,key02:value02},

*{key01:value01,key02:value02}

*]

*}

*

*/

varpeople={"program1":

[

{"firstname":"zhang11","lastname":"sanfeng11","email11":"keni1@com"},

{"firstname":"zhang12","lastname":"sanfeng12","email12":"keni2@com"}

],

"program2":

[

{"firstname":"zhang21","lastname":"sanfeng21","email":"keni21@com"},

{"firstname":"zhang22","lastname":"sanfeng22","email":"keni22@com"}

],

"program3":

[

{"firstname":"zhang31","lastname":"sanfeng31","email":"keni31@com"},

{"firstname":"zhang32","lastname":"sanfeng32","email":"keni32@com"}

]

}

//輸出people對象program3對象中第一個對象的last的值

alert(people.program3[0].lastname);

</script>

ex05

<scriptlanguage="JavaScript">

varpeople={

"username":"zhang",

"sex":"male",

"tel":{"phone":"110","cell":"13812345678"},

"address":[

{"city":"tieling","postcode":"110"},

{"city":"beijing","postcode":"100"}

]

}

alert(people.username);

alert(people.tel.cell);

alert(people.address[1].city);

alert(people.address[1].postcode)

</script>

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

分宜县| 安岳县| 永吉县| 高台县| 武平县| 介休市| 深泽县| 万盛区| 滦平县| 通江县| 抚顺县| 阿瓦提县| 嘉鱼县| 民权县| 镇坪县| 邯郸市| 诏安县| 汉川市| 封开县| 武隆县| 波密县| 西宁市| 台南市| 榕江县| 洛南县| 丹棱县| 奉新县| 高安市| 滦平县| 江津市| 阿城市| 三河市| 都兰县| 鄂托克前旗| 宝鸡市| 许昌县| 柳林县| 株洲市| 泽普县| 汉寿县| 海丰县|