var myNewKeyNames = ['asas','asas'];
var obj =[{key:'value',key:'value'}]
for(var i =0; i<obj.length; i++) {
for(key in the obj[i]) {
alert(key) // gives the keys in the object
alert(myNewKeyNames) instead of key in the object which would rep the values
alert(value) // gives the value in the object
}
}
現在我可以將密鑰變成其他值....沒有使用我的循環密鑰值。我試圖替換...像這樣...但它沒有采取...在運行時替換對象的密鑰與dupliacte值
我不想在初始階段重新命名鍵,只是當在那個時候我在textboxxx中打印的鍵想要命名它不同...
請儘量描述您的問題更清晰,使一些代碼格式化。 –
@DotNET忍者:完成後,檢查以上 –