首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

不太明白JS给一变量赋值时用大括号表示什么意思,例如this.config={ target:null,folerLink:true},该怎么处理

2012-02-21 
不太明白JS给一变量赋值时用大括号表示什么意思,例如this.config{ target:null,folerLink:true}例如以下

不太明白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 ";
[解决办法]
{}是定义对象的一种方法,就像用[]来定义数组一样

热点排行
Bad Request.