<script type="text/javascript">
var X = {
a: [{name:john, phone:777},{name:john, phone:777},{name:john, phone:777}],
b: [{name:john, phone:777},{name:john, phone:777},{name:john, phone:777}],
c: [{name:john, phone:777},{name:john, phone:777},{name:john, phone:777}],
d: [{name:john, phone:777},{name:john, phone:777},{name:john, phone:777}]
}
var str = JSON.stringify(X);
alert(str);
</script>
這個對象有什麼問題?它警告「未捕獲的ReferenceError:john未定義」 怎麼回事?JS object undefined problem
約翰需要加引號,因爲它是一個字符串不是一個變量標識符 – meouw 2011-05-11 12:12:42
@meouw,您應該已經是一個答案,而不是評論+ 1個 – rsplak 2011-05-11 12:14:01