<div id="menu">
<ul>
<li><a href="/" id="main">Main</a></li>
</ul>
</div>
<script type="text/javascript">
var main = new Object();
main.menu_background_image = "url(images/main.png)";
function setMenuImages() {
var menuListArray = $$('#menu li');
var menuListArrayLength = menuListArray.length;
for(var k = 0; k < menuListArrayLength; k++) {
var listMenuId = menuListArray[k].getChildren('a').get('id');
menuListArray[k].setStyle('background-image', listMenuId['menu_background_image']);
}
}
</script>
当我调用 setMenuImages() 时,我无法从地图中获取价值,我不知道为什么:( 我用警报检查了它,它说“未定义”。我做错了什么?