js 菜菜鸟问几个js的问题
谁能帮我解释一下这个函数呢??
对js 不是很了解
谢谢了。。
function AddGroup(strName, strUrl)
{
var objGroup = document.createElement("DIV");
var objTitle = document.createElement("DIV");
var objContent = document.createElement("DIV");
var objTopices = document.createElement("TABLE");
var objTopicesBody = document.createElement("TBODY");
var objTopicToolTip = document.createElement("DIV");
objGroup.className = "listGroup";
objContent.className = "listContent";
objTopices.className = "listTopices";
objTopicToolTip.className = "topicToolTip";
objContent.style.display = "none";
objContent.setAttribute("loaded", false);
objContent.setAttribute("page", 1);
titleHTMLString = "<table class=listTitle border=0><tr>";
titleHTMLString += "<td class=datactrl width=20 url=" + strUrl + " forumid=" + forumID + ">";
titleHTMLString += "<img id=" + idGroupIcon + " class=listGroupIcon border=0 width=16 height=15 align=absmiddle src=" + ImgGroupCollapse + "></img></td>";
/* lee1892 */
//titleHTMLString += "<td class=listTitleLink><a target='_blank' href=" + strUrl + ">" + strName + "</a><font id=" + idPageNum + " class=listPageNum></font></td>";
titleHTMLString += "<td class=listTitleLink><a id=" + idGroupAnchor + " title=" + IDS_LISTICON + " href='#'>" + strName + "</a><font id=" + idPageNum + " class=listPageNum></font></td>";
/* end */
titleHTMLString += "<td class=listIndicator id=" + idIndicator + "></td>";
titleHTMLString += "</tr></table>";
objTitle.innerHTML = titleHTMLString;
objTitle.style.paddingLeft = "5px";
objTopices.appendChild(objTopicesBody);
objContent.appendChild(objTopices);
objGroup.appendChild(objTitle); /*增加三个子元素*/
objGroup.appendChild(objContent);
objGroup.appendChild(objTopicToolTip);
var objIndicator = objTitle.all(idIndicator);
CreateIndicator(objIndicator);
CreateToolTip(objTopicToolTip);
var objGroupIcon = objTitle.all(idGroupIcon);
if (objGroupIcon != null)
{
//objGroupIcon.addBehavior(datacontroller);
objGroupIcon.onclick = DownloadFirstPage;
}
/* lee1892 */
var objGroupAnchor = objTitle.all(idGroupAnchor);
if (objGroupAnchor != null)
{
objGroupAnchor.onclick = function()
{
openInBrowser(strUrl);
}
}
/* end */
element.appendChild(objGroup);
countTopics ++;
}