谁能帮我解释一下这个是javascript的语法还是css的语法,具体是定义什么呀

ERP面壁者 2009-01-16 10:47:36
var OUTLOOKBAR_DEFINITION = {
format:{
target:'main',
blankImage:'images/b.gif',
rollback:true,
animationSteps:2,
animationDelay:20,
templates:{
panel:{
normal:'<div style="width: 100%;"><div style="border-style: solid; border-color: #D0D0D0; border-width: 1px 4px;"><div style="border: 1px outset white; font: bold 8pt verdana; text-align: center; background-color: #A09060; color: white; padding: 4px;">{text}</div></div></div>',
rollovered:'<div style="width: 100%;"><div style="border-style: solid; border-color: #D0D0D0; border-width: 1px 4px;"><div style="border: 1px solid white; font: bold 8pt verdana; text-align: center; background-color: #A09060; color: white; padding: 4px;">{text}</div></div></div>',
clicked:'<div style="width: 100%;"><div style="border-style: solid; border-color: #D0D0D0; border-width: 2px 3px 0 5px;"><div style="border: 1px solid white; font: bold 8pt verdana; text-align: center; background-color: #A09060; color: white; padding: 4px;">{text}</div></div></div>'
},
item:{
normal:'<table border="0" bgcolor="#D0D0D0" cellspacing="3" width="100%"><tr><td width="30" align="center"><img src="images/{image}.gif" width="15" height="15" style="display: block;" /></td><td style="font: 8pt tahoma;">{text}</td></tr></table>',
rollovered:'<table border="0" bgcolor="silver" cellspacing="3" width="100%"><tr><td width="30" align="center"><img src="images/{image}.gif" width="15" height="15" style="display: block;" /></td><td style="font: 8pt tahoma;">{text}</td></tr></table>'
},
upArrow:{
normal:'<img src="images/arr_up.gif" width="30" height="30" />'
},
downArrow:{
normal:'<img src="images/arr_down.gif" width="30" height="30" />'
}
}
},
panels:[
{text:"Positive", url:'dummy.html?id=1',
items:[
{text:"Biggrin", image:'biggrin', url:'dummy.html?id=2'},
{text:"Cool", image:'cool', url:'dummy.html?id=3'},
{text:"Razz", image:'razz', url:'dummy.html?id=4'},
{text:"Smile", image:'smile', url:'dummy.html?id=5'},
{text:"Surprised", image:'surprised', url:'dummy.html?id=6'},
{text:"Wink", image:'wink', url:'dummy.html?id=7'}
]
},
{text:"Other", url:'dummy.html?id=8',
items:[
{text:"Confused", image:'confused', url:'dummy.html?id=9'},
{text:"Doubt", image:'doubt', url:'dummy.html?id=10'},
{text:"Evil", image:'evil', url:'dummy.html?id=11'},
{text:"Mad", image:'mad', url:'dummy.html?id=12'},
{text:"Neutral", image:'neutral', url:'dummy.html?id=13'},
{text:"Red face", image:'redface', url:'dummy.html?id=14'},
{text:"Sad", image:'sad', url:'dummy.html?id=15'},
{text:"Shock", image:'shock', url:'dummy.html?id=16'}
]
},
{text:"Animated", url:'dummy.html?id=17',
items:[
{text:"Roll eyes", image:'rolleyes', url:'dummy.html?id=18'},
{text:"LOL", image:'lol', url:'dummy.html?id=19'},
{text:"Cry", image:'cry', url:'dummy.html?id=20'},
{text:"Badgrin", image:'badgrin', url:'dummy.html?id=21'}
]
},
{text:"Misc", url:'dummy.html?id=22',
items:[
{text:"Arrow", image:'arrow', url:'dummy.html?id=23'},
{text:"Question", image:'question', url:'dummy.html?id=24'},
{text:"Exclamation", image:'exclaim', url:'dummy.html?id=25'},
{text:"Idea", image:'idea', url:'dummy.html?id=26'}
]
}
]
}
...全文
116 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
午夜咖啡男 2009-01-17
  • 打赏
  • 举报
回复
5楼辛苦了哈。
顺带提一句,使用json作为数据载体比如楼主给出的这种格式,通常可以很好的解决单纯的返回html设置innerHTML中的<script>不能自动运行的问题。
tantaiyizu 2009-01-17
  • 打赏
  • 举报
回复
wz_307 2009-01-16
  • 打赏
  • 举报
回复
嗯.5楼讲的很清楚了.

这段js里面虽然很杂, 但都是基本的数据结构. js中的数据结构非常方便, 数组的下标是可以用非数字形式的; 也有map的结构, 调用起来非常方便. 先了解js数据结构, 然后把这段js仔细划分一下是可以研究清楚的.
ulear 2009-01-16
  • 打赏
  • 举报
回复
建议楼主去看下JS初级的书
邓臻昊 2009-01-16
  • 打赏
  • 举报
回复

var OUTLOOKBAR_DEFINITION = { //定义一个对象
format:{ //定义这个对象的一个属性format,这个format属性又是一个对象
target:'main', //定义format对象中的target属性
blankImage:'images/b.gif', //定义format对象中的blankImage属性
rollback:true, //定义format对象中的rollback属性
animationSteps:2, //定义format对象中的animationSteps属性
animationDelay:20,//定义format对象中的animationDelay属性

templates:{ //定义format对象中的templates属性,这个属性又是一个对象,包括了许多属性
panel:{ //定义templates对象中的panel属性,这个属性也是一个对象
//定义panel对象中的normal属性
normal:' <div style="width: 100%;"> <div style="border-style: solid; border-color: #D0D0D0; border-width: 1px 4px;"> <div style="border: 1px outset white; font: bold 8pt verdana; text-align: center; background-color: #A09060; color: white; padding: 4px;">{text} </div> </div> </div>',
//定义panel对象中的rollovered属性
rollovered:' <div style="width: 100%;"> <div style="border-style: solid; border-color: #D0D0D0; border-width: 1px 4px;"> <div style="border: 1px solid white; font: bold 8pt verdana; text-align: center; background-color: #A09060; color: white; padding: 4px;">{text} </div> </div> </div>',
//定义panel对象中的clicked属性
clicked:' <div style="width: 100%;"> <div style="border-style: solid; border-color: #D0D0D0; border-width: 2px 3px 0 5px;"> <div style="border: 1px solid white; font: bold 8pt verdana; text-align: center; background-color: #A09060; color: white; padding: 4px;">{text} </div> </div> </div>'
},


item:{//定义templates对象中的item属性,item也是一个对象
//定义item对象中的normal属性
normal:' <table border="0" bgcolor="#D0D0D0" cellspacing="3" width="100%"> <tr> <td width="30" align="center"> <img src="images/{image}.gif" width="15" height="15" style="display: block;" /> </td> <td style="font: 8pt tahoma;">{text} </td> </tr> </table>',
//定义item对象中的rollovered属性
rollovered:' <table border="0" bgcolor="silver" cellspacing="3" width="100%"> <tr> <td width="30" align="center"> <img src="images/{image}.gif" width="15" height="15" style="display: block;" /> </td> <td style="font: 8pt tahoma;">{text} </td> </tr> </table>'
},

upArrow:{ //定义templates对象中的upArrow属性,upArrow也是一个对象
//定义upArrow对象的normal属性
normal:' <img src="images/arr_up.gif" width="30" height="30" />'
},

downArrow:{ //定义templates对象中的downArrow属性,downArrow也是一个对象
//定义downArrow对象的normal属性
normal:' <img src="images/arr_down.gif" width="30" height="30" />'
}
} //end of templates
}, //end of format

panels:[ //定义OUTLOOKBAR_DEFINITION对象的属性panels,panels是一个数组
//定义数组panels中的元素,这个元素是一个对象
{
//定义这个对象的属性text
text:"Positive",
//定义这个对象的属性url
url:'dummy.html?id=1',
////定义这个对象的属性items,items也是一个数组
items:[
//items数组中又包含了许多的元素,这些元素都是对象,每一个对象又具有自己的text,image,url属性
{text:"Biggrin", image:'biggrin', url:'dummy.html?id=2'},
{text:"Cool", image:'cool', url:'dummy.html?id=3'},
{text:"Razz", image:'razz', url:'dummy.html?id=4'},
{text:"Smile", image:'smile', url:'dummy.html?id=5'},
{text:"Surprised", image:'surprised', url:'dummy.html?id=6'},
{text:"Wink", image:'wink', url:'dummy.html?id=7'}
]
},

//定义数组panels中的元素,这个元素是一个对象
{
text:"Other",
url:'dummy.html?id=8',
items:[ //这里同上
{text:"Confused", image:'confused', url:'dummy.html?id=9'},
{text:"Doubt", image:'doubt', url:'dummy.html?id=10'},
{text:"Evil", image:'evil', url:'dummy.html?id=11'},
{text:"Mad", image:'mad', url:'dummy.html?id=12'},
{text:"Neutral", image:'neutral', url:'dummy.html?id=13'},
{text:"Red face", image:'redface', url:'dummy.html?id=14'},
{text:"Sad", image:'sad', url:'dummy.html?id=15'},
{text:"Shock", image:'shock', url:'dummy.html?id=16'}
]
},

//定义数组panels中的元素,这个元素是一个对象
{
text:"Animated",
url:'dummy.html?id=17',
items:[ //这里同上
{text:"Roll eyes", image:'rolleyes', url:'dummy.html?id=18'},
{text:"LOL", image:'lol', url:'dummy.html?id=19'},
{text:"Cry", image:'cry', url:'dummy.html?id=20'},
{text:"Badgrin", image:'badgrin', url:'dummy.html?id=21'}
]
},

//定义数组panels中的元素,这个元素是一个对象
{
text:"Misc",
url:'dummy.html?id=22',
items:[ //这里同上
{text:"Arrow", image:'arrow', url:'dummy.html?id=23'},
{text:"Question", image:'question', url:'dummy.html?id=24'},
{text:"Exclamation", image:'exclaim', url:'dummy.html?id=25'},
{text:"Idea", image:'idea', url:'dummy.html?id=26'}
]
}
] //end of panels
}//end of OUTLOOKBAR_DEFINITION
fosjos 2009-01-16
  • 打赏
  • 举报
回复
当然是js语法
var a = ["a","b","c"];//表示数组
alert(a[1] + a.length);
var o = {a:"aa", b:"bb", c:"cc"};//表示对象
alert(o.a + o["b"]);
ERP面壁者 2009-01-16
  • 打赏
  • 举报
回复
是类吗
ERP面壁者 2009-01-16
  • 打赏
  • 举报
回复
var OUTLOOKBAR_DEFINITION = {
format:{
target:'main',
blankImage:'images/b.gif',
rollback:true,
animationSteps:2,
animationDelay:20,
templates:{
panel:{
normal:' <div style="width: 100%;"> <div style="border-style: solid; border-color: #D0D0D0; border-width: 1px 4px;"> <div style="border: 1px outset white; font: bold 8pt verdana; text-align: center; background-color: #A09060; color: white; padding: 4px;">{text} </div> </div> </div>',
rollovered:' <div style="width: 100%;"> <div style="border-style: solid; border-color: #D0D0D0; border-width: 1px 4px;"> <div style="border: 1px solid white; font: bold 8pt verdana; text-align: center; background-color: #A09060; color: white; padding: 4px;">{text} </div> </div> </div>',
clicked:' <div style="width: 100%;"> <div style="border-style: solid; border-color: #D0D0D0; border-width: 2px 3px 0 5px;"> <div style="border: 1px solid white; font: bold 8pt verdana; text-align: center; background-color: #A09060; color: white; padding: 4px;">{text} </div> </div> </div>'
}
}
feixuewuhen3812 2009-01-16
  • 打赏
  • 举报
回复
楼主
把代码精简一下
看晕了
yuqinghehappy 2009-01-16
  • 打赏
  • 举报
回复
五楼真是值得表扬啊!
谢在脚本里的为Js
写在style里的为CSS
liuhua19841201 2009-01-16
  • 打赏
  • 举报
回复
是js语法
这个是json数据,到网上找一json数据的定义

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧