crabbear
asked on
mm_menu.js with aspx - unable to retrieve element object , returning undefined
Hi guys,
I'm trying the dynamic menu on .aspx, but its not working as it did in .asp.
I have no problem creating span layer and add submenu on it in asp.
script.js file
function FIND(item) {
if( window.mmIsOpera ) return(document.getElement ById(item) );
if (document.all) return(document.all[item]) ; <-- return undefined when i use it on aspx
if (document.getElementById) return(document.getElement ById(item) );
return(false);
}
function writeMenus(container)
{
...
document.writeln('<span id="menuContainer" ></span>'); <-- this seems not working in aspx
container = FIND("menuContainer");
alert('hey'+container); <-- undefined..
...
}
aspx file (c#)
<script src="../includes/scripts.j s" type="text/javascript"></s cript>
<%
String section = "Main Menu";
String subsection = "stest";
String detail = "img.jpg";
%>
<script type="text/javascript">
<!--
section = "<%=section%>";
subsection = "<%=subsection%>";
detail = "<%=detail%>";
// -->
</script>
<script type="text/javascript">mmL oadMenus() ;</script>
</HEAD>
<body onload="javascript:setnav( '<%=sectio n%>', '<%=subsection%>', '<%=detail%>');">
the js file i used is from :Andy Finnell, March 2002, mm_menu 20MAR2002 Version 6.0
Thanks for the help
I'm trying the dynamic menu on .aspx, but its not working as it did in .asp.
I have no problem creating span layer and add submenu on it in asp.
script.js file
function FIND(item) {
if( window.mmIsOpera ) return(document.getElement
if (document.all) return(document.all[item])
if (document.getElementById) return(document.getElement
return(false);
}
function writeMenus(container)
{
...
document.writeln('<span id="menuContainer" ></span>'); <-- this seems not working in aspx
container = FIND("menuContainer");
alert('hey'+container); <-- undefined..
...
}
aspx file (c#)
<script src="../includes/scripts.j
<%
String section = "Main Menu";
String subsection = "stest";
String detail = "img.jpg";
%>
<script type="text/javascript">
<!--
section = "<%=section%>";
subsection = "<%=subsection%>";
detail = "<%=detail%>";
// -->
</script>
<script type="text/javascript">mmL
</HEAD>
<body onload="javascript:setnav(
the js file i used is from :Andy Finnell, March 2002, mm_menu 20MAR2002 Version 6.0
Thanks for the help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i tried adding:
document.writeln('<span id="menuContainer" ></span>');
var span = document.getElementById("m enuContain er");
alert(span);
as u can see from above.
But it returns null. im stuck
document.writeln('<span id="menuContainer" ></span>');
var span = document.getElementById("m
alert(span);
as u can see from above.
But it returns null. im stuck
ASKER
OH MY GOD...
now it works..
and I dont know why...
Works in asp, BUT not in aspx
document.writeln('<span id="menuContainer" ></span>');
Works in BOTH asp and aspx
document.writeln('<span id="menuContainer"> < /span>');
Crazy browser..
now it works..
and I dont know why...
Works in asp, BUT not in aspx
document.writeln('<span id="menuContainer" ></span>');
Works in BOTH asp and aspx
document.writeln('<span id="menuContainer"> <
Crazy browser..
ASKER
In my main aspx file, i include
<script src="../includes/scripts.j
<%
String section = "EmployeeBasics";
String subsection = "NewEmployees";
String detail = "img-passportVISA.jpg";
%>
<script type="text/javascript">
<!--
section = "<%=section%>";
subsection = "<%=subsection%>";
detail = "<%=detail%>";
document.writeln('<span id="menuContainer" ></span>');
var span = document.getElementById("m
alert(span);
// -->
</script>
<script type="text/javascript">mmL
</HEAD>
<body
onload="javascript:setnav(
and this in my body tag
<!-- #include virtual="/aphr/includes/to
my topnav.aspx display all the menus