首页 >> 文摘 >> JAVASCRIPT

javascript中的json对象

采集日期:2008-4-28作者:phdbrianlee(注:本数据由系统自动采集,内容与BHCODE无关)
var attributes={id:1,cls:"file"}; //访问方式1 alert(attributes.id); //访问方式2 alert(attributes[cls]); //添加新属性name attributes.name = "jsonStr"; var text = "width"; //可动态添加新属性text attributes.text = "this is a new attribute named 'text'. "; //添加新属性width[注意与上面语句的区别] attributes[text] = 50;
本周推荐
MORE
热点关注
MORE