I am getting an error that says an object is required. This code is for a hier menu. I dont know why the first layer works but the second doesnt since i used the same code. the error is
"Object Required: 'document.all.item(...)'
any insight would be great!
"Object Required: 'document.all.item(...)'
any insight would be great!
Code:
DIM menuID,menuObj,bkgrnd
DIM menuID2,menuObj2,bkgrnd2
SUB ShowHide(menuID)
menuObj = "Link" & menuID
bkgrnd = "Head" & menuID
// CHECK IF OPEN
if document.all.item(menuObj).className = "LINKSON" then 'IF MENU OPEN THEN CLOSE
document.all.item(menuObj).className = "LINKSOFF"
document.all.item(bkgrnd).style.backgroundColor = "Red" ' SET CELL BACKGROUND COLOR Red
ELSE
document.all.item(menuObj).className = "LINKSON" ' OPEN MENU
document.all.item(Bkgrnd).style.backgroundColor = "Black" ' SET CELL BACKGROUND COLOR Black
END IF
END SUB
SUB ShowHide2(menuID2)
menuObj2 = "Link" & menuID2
bkgrnd2 = "Head" & menuID2
// CHECK IF OPEN
if document.all.item(menuObj2).className = "LINKSON" then 'IF MENU OPEN THEN CLOSE
document.all.item(menuObj2).className = "LINKSOFF"
document.all.item(bkgrnd2).style.backgroundColor = "Red" ' SET CELL BACKGROUND COLOR Red
ELSE
document.all.item(menuObj2).className = "LINKSON" ' OPEN MENU
document.all.item(Bkgrnd2).style.backgroundColor = "Black" ' SET CELL BACKGROUND COLOR Black
END IF
END SUB
</SCRIPT>
</HEAD>
<BODY>
<TABLE cellspacing="1">
<TBODY>
<TR>
<TD class=HEADING id=head0 ONCLICK=ShowHide(0) align=middle>Standards/Policies</TD></TR>
<TR>
<TD align=left bgColor=#FFFFFF><!-- Menu 1 -->
<DIV class=LINKSOFF id=Link0>
<table cellpadding=0 cellspacing=0 border= width="87">
<tr>
<td class=HEADING2 ONCLICK=ShowHide2(12) width="83" align="center"><font face="Verdana">option 1</font>
<DIV class=LINKSOFF id=Link12>
<br><font color="#FFFFFF">
<a href="Standards%20and%20Policies/Option%201/Test%201.doc">test 1</a></font><br>
<font color="#FFFFFF">test 2</font><br>
<font color="#FFFFFF">test 3</font></DIV>
</td></tr>
<tr>
<td class=HEADING2 ONCLICK=ShowHide2(13) width="83" align="center"><font face="Verdana">option 2</font>
<DIV class=LINKSOFF id=Link13>
<br><font color="#FFFFFF">test 1</font><br>
<font color="#FFFFFF">test 2</font><br>
<font color="#FFFFFF">test 3</font></DIV>
</td></tr>
<tr>
<td class=HEADING2 ONCLICK=ShowHide2(14) width="83" align="center"><font face="Verdana">option 3</font>
<DIV class=LINKSOFF id=Link14>
<br><font color="#FFFFFF">test 1</font><br>
<font color="#FFFFFF">test 2</font><br>
<font color="#FFFFFF">test 3</font></DIV>
</td></tr>
</table>
</TD>
</TR>