0
我想要做的是下面的代碼應該寫成「Hey amber :)「和」Hello Patrick :)「,但它只是給了我一個空的結果。我有一個多維的對象,我想通過Javascript進行預覽,但是我無法獲得足夠的深度來獲得我想要的值
var messages2 =
{
"name":"svdMsgs","args":
[{
"messages":[
{"msg":"Hey amber :)","toId":1276},
{"msg":"Hello patrick :)","toId":1}]
}]
}
for (var key in messages2.args.messages)
{
var obj = messages2.args.messages[key];
document.write(obj['msg']);
}
我建議檢查一步每個屬性/元素的步驟,即'messages.args','messages.args [0]'等 – 2012-04-01 18:05:59