日期:2014-05-16  浏览次数:20369 次

不太明白JS给一变量赋值时用大括号表示什么意思,例如this.config={ target:null,folerLink:true}
例如以下的代码
function   dTree(objName)   {

this.config   =   {

target :   null,

folderLinks :   true,

useSelection :   true,

useCookies :   true,

useLines :   true,

useIcons :   true,

useStatusText :   false,

closeSameLevel :   false,

inOrder :   false

}

this.icon   =   {

root :   'img/base.gif ',

folder :   'img/folder.gif ',

folderOpen :   'img/folderopen.gif ',

node :   'img/page.gif ',

empty :   'img/empty.gif ',

line :   'img/line.gif ',

join :   'img/join.gif ',

joinBottom :   'img/joinbottom.gif ',

plus :   'img/plus.gif ',

plusBottom :   'img/plusbottom.gif ',

minus :   'img/minus.gif ',

minusBottom :   'img/minusbottom.gif ',

nlPlus :   'img/nolines_plus.gif ',

nlMinus :   'img/nolines_minus.gif '

};

this.obj   =   objName;

this.aNodes   =   [];

this.aIndent   =   [];

this.root   =   new   Node(-1);

this.selectedNode   =   null;

this.selectedFound   =   false;

this.completed   =   false;

};

------解决方案--------------------
var a={a:123,b:234,c: "123 "}

相当于
var a=new Object();
a.a=123;
a.b=234;
a.c= "123 ";
------解决方案--------------------
{}是定义对象的一种方法,就像用[]来定义数组一样