Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PROBLEMS with document.all and document.getElementsByTagName

Status
Not open for further replies.

questhaven

Programmer
Mar 28, 2001
81
US
Hi - I am trying to get around using document.all because it is not working in Netscape. The solution that I have been reading about on the internet however, is not working in Netscape either. Could somebody cehck out the code below and see if it looks like I am doing in right? Thanks!

function showAll(){

divColl = document.getElementsByTagName("DIV");
for (i=0; i <divColl.length; i++) {
if (divColl(i).className == &quot;LEVEL3&quot;)
{
divColl(i).style.display =
(isExpanded) ? &quot;none&quot; : &quot;block&quot;;
}

if (divColl(i).className == &quot;level2&quot;)
{
divColl(i).style.display =
(isExpanded) ? &quot;none&quot; : &quot;block&quot;;
}
}
}
 

could you post the html that calls the script?

- g
 
Sure!

Response.Write(&quot;<A onclick=&quot;&quot;showAll()&quot;&quot; href=&quot;&quot;#&quot;&quot;>Expand All</A>   <A onclick=&quot;&quot;CollapseAll()&quot;&quot; href=&quot;&quot;#&quot;&quot;>Collapse All</A></div><BR><BR>&quot;)

<%if groupby = &quot;patient&quot; then
if patient_id <> old_patientID then
if iGroup > 0 then %>
</div>
<%end if
iGroup = iGroup + 1 %>
<a class=&quot;LEVEL0&quot; id=&quot;grp<%=iGroup%>a&quot;>
<img src=&quot;<%=listIcon%>&quot; border=&quot;0&quot; class=&quot;LEVEL0&quot; id=&quot;grp<%=iGroup%>b&quot; width=&quot;11&quot; height=&quot;11&quot;></a>

<a href=&quot;patient.asp?patient_id=<%=patient_id%>&quot; target=&quot;_top&quot;><%=notePatient%> (<%=noteDolphinAccount%>)</A> 

<%if noteOwnerID <> st.user_id then Response.write(&quot;Referred from Dr. &quot; & noteOwnerName)end if%><BR>
<div class=&quot;LEVEL3&quot; id=&quot;grp<%=iGroup%>c&quot; style=&quot;display:none&quot;>
<%old_patientID = patient_id
end if%>
<span name=&quot;note<%=iNote%>&quot; id=&quot;note<%=iNote%>&quot; class=&quot;<%=noteClass%>&quot;>

<a class=&quot;LEVEL1&quot; id=&quot;out<%=iNote%>a&quot;>
<img src=&quot;<%=listIcon%>&quot; border=&quot;0&quot; class=&quot;LEVEL1&quot; id=&quot;out<%=iNote%>b&quot; width=&quot;11&quot; height=&quot;11&quot;></A>

 <%=noteIcon%> <%=notename%> <%=smallDate(notetime) & &quot; &quot; & removeseconds(notetime)%>

<%if noteIcon = &quot;To:&quot; and noteclass=&quot;unreadnote&quot; then
Response.Write(&quot;(unread)&quot;)
end if%>
</a><BR></span>
<div class=&quot;level2&quot; <%=noteStyle%>id=&quot;out<%=iNote%>c&quot;>
<p class=&quot;level2&quot; ><%=noteMessage%>
 
guesthave,

It's easier if you post the rendered HTML rather than your ASP page. Could you post us what you see in your browser > view source? Gary Haran
==========================
 
Here you go!

<A onclick=&quot;showAll()&quot; href=&quot;#&quot;>Expand All</A>&nbsp;&nbsp;&nbsp;<A onclick=&quot;CollapseAll()&quot; href=&quot;#&quot;>Collapse All</A></div><BR><BR>
<a class=&quot;LEVEL0&quot; id=&quot;grp1a&quot;>
<img src=&quot;plus.gif&quot; border=&quot;0&quot; class=&quot;LEVEL0&quot; id=&quot;grp1b&quot; width=&quot;11&quot; height=&quot;11&quot;></a>
<a href=&quot;patient.asp?patient_id=103&quot; target=&quot;_top&quot;>Serafini, Maureen (982218)</A>&nbsp; Referred from Dr. Mike Smith<BR>
<div class=&quot;LEVEL3&quot; id=&quot;grp1c&quot; style=&quot;display:none&quot;>
<span name=&quot;note0&quot; id=&quot;note0&quot; class=&quot;readnote&quot;><a class=&quot;LEVEL1&quot; id=&quot;out0a&quot;>
<img src=&quot;plus.gif&quot; border=&quot;0&quot; class=&quot;LEVEL1&quot; id=&quot;out0b&quot; width=&quot;11&quot; height=&quot;11&quot;></A>&nbsp;Note&nbsp;&nbsp;25&nbsp;Feb 12:14&nbsp;PM</a><BR></span>

<div class=&quot;level2&quot; style=&quot;display:none;&quot; id=&quot;out0c&quot;>
<p class=&quot;level2&quot; >test message here</p></div>
 
guesthavem

I have just formatted your code and I get a lot of errors in it. You have a closing div but not starting tag for it. You also have a lonesome closing anchor tag. Fix up your HTML code to try to make things easier for yourself. You can use HTML tidy (free I believe) or a validator to check your code. Usually DHTML code will not work with HTML that cannot validate.

<A onclick=&quot;showAll()&quot; href=&quot;#&quot;>Expand All</A>
<A onclick=&quot;CollapseAll()&quot; href=&quot;#&quot;>Collapse All</A>
</div>
<BR>
<BR>
<a class=&quot;LEVEL0&quot; id=&quot;grp1a&quot;>
<img src=&quot;plus.gif&quot; border=&quot;0&quot; class=&quot;LEVEL0&quot; id=&quot;grp1b&quot; width=&quot;11&quot; height=&quot;11&quot;>
</a>

<a href=&quot;patient.asp?patient_id=103&quot; target=&quot;_top&quot;>Serafini, Maureen (982218)</A>

Referred from Dr. Mike Smith
<BR>

<div class=&quot;LEVEL3&quot; id=&quot;grp1c&quot; style=&quot;display:none&quot;>
<span name=&quot;note0&quot; id=&quot;note0&quot; class=&quot;readnote&quot;>
<a class=&quot;LEVEL1&quot; id=&quot;out0a&quot;>
<img src=&quot;plus.gif&quot; border=&quot;0&quot; class=&quot;LEVEL1&quot; id=&quot;out0b&quot; width=&quot;11&quot; height=&quot;11&quot;>
</A>

Note 25 Feb 12:14 PM
</a>
<BR>
</span>

<div class=&quot;level2&quot; style=&quot;display:none;&quot; id=&quot;out0c&quot;>
<p class=&quot;level2&quot; >test message here</p>
</div>
Gary Haran
==========================
 
Actually - there is a loop that I forgot to include around the <div> tag you are talking about - this code loops around a patient list and around that </div> tag there is actually code that says:

<%if iGroup > 0 then %>
</div>
<%end if
iGroup = iGroup + 1 %>

This closes the </div> for the <div class=&quot;LEVEL3&quot; id=&quot;grp1c&quot; style=&quot;display:none&quot;> tag. However - removing the extra </a> tag does not solve the issue I am having with the <div> expansion not working in Netscape. Is there anything else that could be causing this? The things I have read say that document.getElementsByTagName is supposed to work in Netscape.

Thanks!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top