1
選定子節點我有一個具有以下結構的JSON數據源類型:顯示從URL
{
"list":
[
{
"id": "4167845External",
"personId": 4167845,
"profileId": 4268472,
"personType": "External",
"cat": "person",
"imageId": "10300600",
"extn": "88976",
"profileUrl":
[
"id-mark",
"mar123"
]}],
對於數組profileUrl
,我寫了下面的JavaScript代碼把它顯示在網頁上:
function Staff(person) {
var list = "";
for (var i = 0; i < person.length; ++i) {
var record = person[i];
list +=
"<tr><td>"
+ record.profileUrl
+ "</td><tr>\n";
}
document.getElementById("showList").innerHTML = list;
}
頁面會顯示id-mark,mar123
,如果我想只顯示mar123
我運行它,但我應該怎麼辦?
詢問數組的第二個元素,例如: record.profileUrl [1] – Keith