function myFunction()
{
var x; //声明变量x;
var txt=""; //声明变量txt并赋值为空;
var person={fname:"Bill",lname:"Gates",age:56}; //json对象
for (x in person) //遍历json对象(x就是键相当于fname,lname,age)
{
txt=txt + person[x]; //person[x]相当于person[fname]="Bill",person[lname]="Gates",person[age]="56";
}
document.getElementById("#demo").innerHTML=txt; //id为demo标签的值为txt;
}