Closed Thread Icon

Topic awaiting preservation: menu1 undefined (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=22465" title="Pages that link to Topic awaiting preservation: menu1 undefined (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: menu1 undefined <span class="small">(Page 1 of 1)</span>\

 
vjoneja
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Jul 2004

posted posted 07-07-2004 19:07

var menu1 = new Array(5)
<%do until rs_1.EOF %>
menu1[i]='<a href="https://www.websurveillance.com/store/search.asp?Keyword=900"><%=rs_1("SubCategoryName")%></a><br>'
i = i + 1
<%rs_1.movenext
loop
rs_1.close
%>


var menu2 = new Array(5)
menu2[0]='<a href=test.htm><font color="#FFFFFF">Menu link here</font></a><br>'
menu2nt='<a href=test.htm><font color="#FFFFFF">Menu link here</font></a><br>'
menu2number2='<a href=test.htm><font color="#FFFFFF">Menu link here</font></a><br>'

var menu3 = new Array(5)
menu3[0]='<a href=test.htm><font color="#FFFFFF">Menu link here</font></a><br>'
menu3nt='<a href=test.htm><font color="#FFFFFF">Menu link here</font></a><br>'
menu3number2='<a href=test.htm><font color="#FFFFFF">Menu link here</font></a><br>'


var menu4 = new Array(5)
menu4[0]='<a href=test.htm><font color="#FFFFFF">Menu link here</font></a><br>'
menu4nt='<a href=test.htm><font color="#FFFFFF">Menu link here</font></a><br>'
menu4number2='<a href=test.htm><font color="#FFFFFF">Menu link here</font></a><br>'


var menu5 = new Array(5)
menu5[0]='<a href=test.htm><font color="#FFFFFF">Menu link here</font></a><br>'
menu5nt='<a href=test.htm><font color="#FFFFFF">Menu link here</font></a><br>'
menu5number2='<a href=test.htm><font color="#FFFFFF">Menu link here</font></a><br>'


</script>

<style>
<!--
.wrap1{
position:relative;
}
.wrap2{
position:absolute;
}
#dropmenu0, #dropmenu1, #dropmenu2, #dropmenu3, #dropmenu4{
z-index:100;
}
-->
</style>

</head>

<body>
<script language="JavaScript">//reusable/////////////////////////////



var zindex=100
var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all
var opr=navigator.userAgent.indexOf("Opera")

function dropit(e,whichone){
curmenuID=ns6? document.getElementById(whichone).id : eval(whichone).id
if (window.themenu&&themenu.id!=curmenuID)
themenuStyle.visibility=ns4?"hide" : "hidden"

themenu=ns6? document.getElementById(whichone): eval(whichone)
themenuStyle=(ns6||ie4)? themenu.style : themenu

themenuoffsetX=(ie4&&opr==-1)? document.body.scrollLeft : 0
themenuoffsetY=(ie4&&opr==-1)? document.body.scrollTop : 0

themenuStyle.left=ns6||ns4? e.pageX-e.layerX : themenuoffsetX+event.clientX-event.offsetX
themenuStyle.top=ns6||ns4? e.pageY-e.layerY+19 : themenuoffsetY+event.clientY-event.offsetY+18

hiddenconst=(ns6||ie4)? "hidden" : "hide"
if (themenuStyle.visibility==hiddenconst){
themenuStyle.visibility=(ns6||ie4)? "visible" : "show"
themenuStyle.zIndex=zindex++
}
else
hidemenu()
return false
}

function hidemenu(){
if ((ie4||ns6)&&window.themenu)
themenuStyle.visibility="hidden"
else if (ns4)
themenu.visibility="hide"
}

if (ie4||ns6)
document.onclick=hidemenu

//reusable/////////////////////////////
</script>




<div id=dropmenu0 style="position:absolute;left:0;top:0;layer-background-color:lightyellow;background-color:white;width:150;visibility:hidden;border:1px solid black;padding:0px">
<script language="JavaScript">
if (document.all)
dropmenu0.style.padding="4px"
for(i=0;i<menu1.length;i++)
document.write(menu1[i])
</script>
</div>
<script language="JavaScript1.2">
if (document.layers){
document.dropmenu0.captureEvents(Event.CLICK)
document.dropmenu0.onclick=hidemenu
}
</script>

<div id=dropmenu1 style="position:absolute;left:0;top:0;layer-background-color:lightyellow;background-color:white;width:150;visibility:hidden;border:1px solid black;padding:0px">
<script language="JavaScript">
if (document.all)
dropmenu1.style.padding="4px"
for (a=0;a<menu2.length;a++)
document.write(menu2[a])
</script>
</div>
<script language="JavaScript">
if (document.layers){
document.dropmenu1.captureEvents(Event.CLICK)
document.dropmenu1.onclick=hidemenu
}
</script>

<div id=dropmenu2 style="position:absolute;left:0;top:0;layer-background-color:lightyellow;background-color:white;width:150;visibility:hidden;border:1px solid black;padding:0px">
<script language="JavaScript1.2">
if (document.all)
dropmenu2.style.padding="4px"
for (b=0;b<menu3.length;b++)
document.write(menu3[b])
</script>
</div>
<script language="JavaScript">
if (document.layers){
document.dropmenu2.captureEvents(Event.CLICK)
document.dropmenu2.onclick=hidemenu
}
</script>

<div id=dropmenu3 style="position:absolute;left:0;top:0;layer-background-color:lightyellow;background-color:red;width:150;visibility:hidden;border:1px solid black;padding:0px">
<script language="JavaScript">
if (document.all)
dropmenu3.style.padding="4px"
for (c=0;c<menu4.length;c++)
document.write(menu4[c])
</script>
</div>
<script language="JavaScript">
if (document.layers){
document.dropmenu3.captureEvents(Event.CLICK)
document.dropmenu3.onclick=hidemenu
}
</script>

<div id=dropmenu4 style="position:absolute;left:0;top:0;layer-background-color:lightyellow;background-color:red;width:150;visibility:hidden;border:1px solid black;padding:0px">
<script language="JavaScript">
if (document.all)
dropmenu4.style.padding="4px"
for (d=0;d<menu5.length;d++)
document.write(menu5[d])
</script>
</div>
<script language="JavaScript1.2">
if (document.layers){
document.dropmenu4.captureEvents(Event.CLICK)
document.dropmenu4.onclick=hidemenu
}
</script>

</font>



<!--webbot bot="HTMLMarkup" endspan -->




<!--new code -->
<center>
<table border="0" cellpadding="0" cellspacing="0" width="800">
<tr>
<td width="100%" height="101">
<table border="0" width="99%" height="109">
<tr>
<td width="13%" height="105"><img border="0" src="/images/home121999/WS1.jpg" width="100" height="100"></td>
<td width="57%" height="105">
<table border="0" width="100%" height="103">
<tr>
<td width="530" height="69"><img border="0" src="/images/home121999/header1.gif" width="490" height="69"></td>
</tr>
<tr>
<td width="100%" height="40"><img border="0" src="/images/home121999/header2.gif" width="490" height="40"></td>
</tr>
</table>
<td> <img border="0" src="/images/home121999/animate1.gif" width="127" height="127"></td>
<td width="117%" height="105"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%">

<!----------Menu 1-->

<table border="0" width="99%" cellspacing="0" cellpadding="1">
<tr>

<td bgcolor="#FF0000" width="23%" align="left">
<p align="center">
<a href="/index.asp" target="_top"><font color="#FFFFFF"><b>Home</b></font></a>
</td>


<td bgcolor="#FF0000" width="20%" align="left">
<p align="left"><font face="Arial" size="2">
<!--webbot bot="HTMLMarkup" startspan -->


<!------
<tr>
<td width="100%">

<font face="Arial, Helvetica" size="2"><b>
---->

<ilayer>
<layer visibility=show>
<div class=wrap1>
<span class=wrap2 onMouseOver="dropit(event, 'dropmenu0');event.cancelBubble=true;return false"><a href="http://www.websurveillance.com/store/search.asp?Keyword=wireless" onClick="if(ns4) return dropit(event, 'document.dropmenu0')"><font color="#FFFFFF"><b>Wireless Camera</b></font></a>
</span>
</div>
</layer>
</ilayer><br>
<!----------Menu 1 ends here-------------->

<!-----webbot bot="HTMLMarkup" endspan --->
</font>
</td>

<!----------Menu 2 starts here-->
<td bgcolor="#FF0000" width="20%" align="left">
<p align="left"><font face="Arial" size="2">
<ilayer>
<layer visibility=show>
<div class=wrap1>
<span class=wrap2 onMouseOver="dropit(event, 'dropmenu1');event.cancelBubble=true;return false"><a href="alternate.htm" onClick="if(ns4) return dropit(event, 'document.dropmenu1')"><font color="#FFFFFF"><b>Wired Camera</b></font></a>
</span>
</div>
</layer>
</ilayer><br><!--webbot bot="HTMLMarkup" endspan -->
</font>
</td>


<!----------Menu 2 ends here---------->


<!----------Menu 3 starts here---------->
<td bgcolor="#FF0000" width="20%" align="left">
<p align="left"><font face="Arial" size="2">
<ilayer>
<layer visibility=show>
<div class=wrap1>
<span class=wrap2 onMouseOver="dropit(event, 'dropmenu2');event.cancelBubble=true;return false"><a href="alternate.htm" onClick="if(ns4) return dropit(event, 'document.dropmenu2')"><font color="#FFFFFF"><b>DVR'S</b></font></a>
</span>
</div>
</layer>
</ilayer><br><!--webbot bot="HTMLMarkup" endspan -->
</font>
</td>



<!----------Menu 3 ends here---------->


<!----------Menu 4 starts here---------->
<td bgcolor="#FF0000" width="20%" align="left">
<p align="left"><font face="Arial" size="2">

<ilayer>
<layer visibility=show>
<div class=wrap1>
<span class=wrap2 onMouseOver="dropit(event, 'dropmenu3');event.cancelBubble=true;return false"><a href="alternate.htm" onClick="if(ns4) return dropit(event, 'document.dropmenu3')"><font color="#FFFFFF"><b>Accessories</b></font></a>
</span>
</div>
</layer>
</ilayer><br><!--webbot bot="HTMLMarkup" endspan -->
</font>
</td>


<!----------Menu 4 ends here---------->


<!----------Menu 5 starts here---------->
<td bgcolor="#FF0000" width="20%" align="left">
<p align="left"><font face="Arial" size="2"><!--webbot bot="HTMLMarkup" startspan -->

<!--
<ilayer>
<layer visibility=show>
<div class=wrap1>
<span class=wrap2 onMouseOver="dropit(event, 'dropmenu4');event.cancelBubble=true;return false"><a href="alternate.htm" onClick="if(ns4) return dropit(event, 'document.dropmenu4')"><font color="#FFFFFF"><b>Click here</b></font></a>
</span>
</div>
</layer>
</ilayer><br></td>
</tr>
</table>


<!------</b></font>
</td>
</tr>
<tr>-->

<!----------Menu 5 ends here---------->

</tr>
<tr>
<td><img src="/images/spacing.gif" width="1" height="5"><br><font face="Arial, Helvetica" size="2"><script language="Javascript">




</script>





I am trying to create drop down database driven menu with javascript and
asp
this is the whole script i m getting error in the
for (a=0;a<menu2.length;a++)
in this statement it says that menu2 is undefined
it says for all the menu items
like menu1 is undefined
like menu2
menu3
menu4
menu5
I dont know i have declared the menu array
I am not sure how else to define it
I HAVE
var menu = new array()
please help me out if you have any clue what does undefined in this case is ...
for (a=0;a<menu2.length;a++)

Iron Wallaby
Paranoid (IV) Inmate

From: USA
Insane since: May 2004

posted posted 07-07-2004 19:40

I take it that this:

<%do until rs_1.EOF %>
menu1[i]='<a href="https://www.websurveillance.com/store/search.asp?Keyword=900"><%=rs_1("SubCategoryName")%></a><br>'
i = i + 1
<%rs_1.movenext
loop
rs_1.close
%>

is from the ASP. If that is the case, are you sure that rs_1 does NOT loop more than 5 times?

You may want to change it to:

<%do until rs_1.EOF %>
if(i>4) alert("Loop counter has gone too high!");
menu1[i]='<a href="https://www.websurveillance.com/store/search.asp?Keyword=900"><%=rs_1("SubCategoryName")%></a><br>'
i = i + 1
<%rs_1.movenext
loop
rs_1.close
%>

And then you will know if that is the case or not.

"Any sufficiently advanced technology is indistinguishable from magic." -- Arthur C. Clarke
"Any sufficiently arcane magic is indistinguishable from technology." -- P. David Lebling

(Edited by Iron Wallaby on 07-07-2004 19:43)

ninmonkey
Nervous Wreck (II) Inmate

From:
Insane since: Nov 2003

posted posted 07-07-2004 19:40

If this is javascript, you are missing a lot of semicolons.

It's a lot easier to read if you post a url. If that's not possible, please use the code tags.

hyperbole
Paranoid (IV) Inmate

From: Madison, Indiana, USA
Insane since: Aug 2000

posted posted 07-07-2004 20:09

You need to initializ3e i before you use it.

I.e set it to 0 or some other valid value.

-- not necessarily stoned... just beautiful.

« BackwardsOnwards »

Show Forum Drop Down Menu