Hi All,
I'm trying to achieve this functinality given in this forum on my dnn page . http://forums.asp.net/t/1225510.aspx
I have placed a unordered list inside left pane div of my skin.ascx file as below.
<ul id="TopMenu">
<li><a href="page1.aspx"> page1 </a>
<ul>
<li><a href="page2.aspx"> page2 </a></li>
<li><a href="page3.aspx"> page3 </a></li>
<li><a href="page4.aspx"> page4 </a></li>
</ul>
</li>
<li><a href="#"> page5 </a></li>
<li><a href="#"> page6 </a> </li>
</ul>
I need to register a js file for this control and i placed it inside the skin folder and registered it in the following syntax.Is it the right way to do as the javascript is not working?
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Page.ClientScript.RegisterClientScriptInclude("MenuFix", "<%=SkinPath%>menu.js")
End Sub
The following is the js file.
function menuFix() {
var sfEls = document.getElementById("TopMenu").getElementsByTagName("li");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onclick = function() {
if(this.className.indexOf("sfhover") < 0)
{
//Expend this
this.className+=(this.className.length>0? " ": "") + "sfhover";
//Close Others
var sfEls2 = document.getElementById("TopMenu").getElementsByTagName("li");
for (var i=0; i<sfEls2.length; i++) {
if(sfEls2[i].className.indexOf("sfhover") >= 0 && sfEls2[i] != this)
{
sfEls2[i].className=sfEls2[i].className.replace(new RegExp("( ?|^)sfhover\\b"),"");
}
}
}
else
{
this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"),"");
}
}
}
}
window.onload=menuFix;
Where do i need to call the function menuFix in order for it to get working in the ascx file. Shoud it be window.onload?
Can anybody please tell me what is the mistake being done here.
Thanks in advance.
-sri