[code="java"]
function bulList(cat,myUrl){
var myL = document.createElement("li");
var myA = document.createElement("a");
myL.appendChild(myA);
myA.setAttribute = ("href",myUrl); //添加链接
myA.appendChild(document.createTextNode(cat));//添加a标签内的文本
return bulList;
}
function topList(){
var topNav = document.getElementById("top-nav");
var navLinks = bulList("aaa","/ddd/x.html") //调用上面那个bulList函数
topNav.appendChild(navLinks);
}
window.onload = topList;
[/code]
这是一个li的情况,有效的话我要添加多个li链接,但是页面上什么也没出现。
请问应该怎么改?