输出javascript对象中属性的名称和值
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了输出javascript对象中属性的名称和值相关的知识,希望对你有一定的参考价值。
The code below will loop through the properties in an object and alert a string. myObject is in JSON notation. The "for ( x in y)" construct does not work if the Prototype.js library is included on the page
// output the name and value of all the objects properties var s = ""; for (var property in myObject) { s = s + " "+property +": " + myObject[property] ; } alert(s);
以上是关于输出javascript对象中属性的名称和值的主要内容,如果未能解决你的问题,请参考以下文章
选择带有名称[] 和值的复选框(jquery/javascript)