var jsonObject={
"firstname":"xiaoming";
"lastname":"wang";
}
请问js怎么获取键名啊,就是"firstname","lastname"
------解决方案--------------------
JScript code
var jsonObject={
"firstname":"xiaoming",
"lastname":"wang"
},keys=[];
for(var p in jsonObject)if(jsonObject.hasOwnProperty(p))keys.push(p);
alert(keys);