...

View Full Version : getElementByTagName not working in Firefox



hd181a
12-20-2007, 01:32 AM
I have the following code that I am trying to get working in Firefox. When I call getElementByTagName I get a message saying it is not a function.

function fncheckcontained(e)
{
var lblncontained; // Boolean Variable to hold the status of the ID
var lstrCurrentItem; //Variable to hole current Item.
var lstrfoldercontent; //Variable to hold folder content.
lblncontained=false;
lstrCurrentItem=ns6Op8? e.target : event.srcElement;

if (lstrCurrentItem.id=="foldheaderTreeView")
{
lblncontained=true;
}
else
while (ns6Op8&&lstrCurrentItem.parentNode||(ie4&&lstrCurrentItem.parentElement))
{
if (lstrCurrentItem.id=="foldheaderTreeView"||lstrCurrentItem.id=="foldinglistTreeView")
{
lblncontained=(lstrCurrentItem.id=="foldheaderTreeView")? true : false
break;
}
lstrCurrentItem=ns6Op8? lstrCurrentItem.parentNode : lstrCurrentItem.parentElement
}
if (lblncontained==true)
{
if (ns6Op8) {
lstrfoldercontent=lstrCurrentItem.getElementByTagName("UL")[0];
}
else {
lstrfoldercontent=lstrCurrentItem.all.tags("UL")[0]
}
//lstrfoldercontent=ns6Op8? lstrCurrentItem.nextSibling.nextSibling : lstrCurrentItem.all.tags("UL")[0]
if (lstrfoldercontent.style.display=="none")
{
lstrfoldercontent.style.display=""
// Ver 1$ Start
lstrCurrentItem.style.listStyleImage="url(minus.gif)"
// Ver 1$ End
}
else
{
lstrfoldercontent.style.display="none"
// Ver 1$ Start
lstrCurrentItem.style.listStyleImage="url(plus.gif)"
// Ver 1$ End
}
}
event.cancelBubble = true;
}
Here is the HTML

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<TABLE border=0 cellpadding=0 cellspacing=0 width='260' class='gContentSection'>
<TR>
<TD class='gContentSection'>
<UL>
<LI id=foldheaderTreeView onclick = "javascript:fncheckcontained45411(event);"><U><A onclick="javascript:fnNewWindow45411('http://cnn.com','1')" >Boeing.com</A></U>
<UL id=foldinglistTreeView style="DISPLAY: none;head: " onclick = "javascript:fncheckcontained45411(event);" >
<LI id=foldheaderListTreeView onclick = "javascript:fncheckcontained45411(event);"><U><A onclick="javascript:fnNewWindow45411('http://asdf.com','1')" >Inside Boeing</A></U></LI>
<UL id=foldinglistTreeView style="DISPLAY: none; head: " onclick = "javascript:fncheckcontained45411(event);"> </UL>
</UL>
</LI>
<LI id=foldheaderListTreeView onclick = "javascript:fncheckcontained45411(event);"><U><A onclick="javascript:fnNewWindow45411('\\\\server\\portalimages','1')" >\\server\portalimages</A></U></LI><UL id=foldinglistTreeView style="DISPLAY: none; head: " > </UL><LI id=foldheaderTreeView >No-Link<UL id=foldinglistTreeView style="DISPLAY: none;head: " > <LI id=foldheaderListTreeView ><U><A onclick="javascript:fnNewWindow45411('\\\\server\\portalimages\\paul','1')" >\\server\portalimages\paul</A></U></LI>
<UL id=foldinglistTreeView style="DISPLAY: block;head: " > </UL>
</UL>
</LI></UL>
</TD>
</TR>
<TR><TD class='gContentSection'><I>FireFox Test </I></TD></TR>
</TABLE>
</BODY>
</HTML>

Trinithis
12-20-2007, 01:48 AM
getElementsByTagName

hd181a
12-20-2007, 01:54 AM
I can't believe I missed that. Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum