对javascript完全不了解,网上找的做动态下拉菜单的代码,结果提示错误:
网页错误详细信息
用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
时间戳: Sun, 15 Sep 2013 03:53:31 UTC
消息: 缺少 ';'
行: 2
字符: 6
代码: 0
URI: file:///E:/做网站资料/updateindex/js/h_nav_menu.js
附上源代码:
// JavaScript Document
1 window.onload = initMenu;
2
3 function initMenu() {
4 assembleMenu(document.getElementById("menu"));
5 }
6
7 function assembleMenu(uLParentNode) {
8 var theUL = uLParentNode.getElementsByTagName("ul")[0];
9 var theULChilds = theUL.childNodes;
10
11 for (var i=0; i<theULChilds.length; i++) {
12 if (theULChilds[i].tagName == "LI") {
13 var theLINode = theULChilds[i];
14 if (hasNextLevelMenu(theLINode)) {
15 setMouseActions(theLINode);
16 theLINode.firstChild.className = uLParentNode.tagName == "DIV" ? "downMenu" : rightMenu";
17
18 assembleMenu(theLINode);
19 }
20 }
21 }
22
23 function hasNextLevelMenu(node) {
24 return node.getElementsByTagName("ul").length > 0;
25 }
26
27 function setMouseActions(node) {
28 node.onmouseover = function() {
29 this.getElementsByTagName("ul")[0].style.display = "block";
30 };
31
32 node.onmouseout = function() {
33 this.getElementsByTagName("ul")[0].style.display = "none";
34 };
35 }
36 }
--
FROM 112.65.211.*