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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Netscape Question --

Status
Not open for further replies.

Berns

IS-IT--Management
Apr 25, 2002
41
US
I would like to have an expanding menu on my website, since I got the code from a JS website. The problem is that it works fine in IE but doesn't work at all in Netscape. Here is a sniplet:
in the header:
img1=new Image()
img1.src="/images/fold.jpg"
img2=new Image()
img2.src="/images/open.jpg"
ns6_index=0

function change(e){

if(!document.all&&!document.getElementById)
return

if (!document.all&&document.getElementById)
ns6_index=1

var source=document.getElementById&&!document.all? e.target:event.srcElement
if (source.className=="folding"){
var source2=document.getElementById&&!document.all? source.parentNode.childNodes:source.parentElement.all
if (source2[2+ns6_index].style.display=="none"){
source2[0].src="/images/open.jpg"
source2[2+ns6_index].style.display=''
}
else{
source2[0].src="/images/fold.jpg"
source2[2+ns6_index].style.display="none"
}
}
}
document.onclick=change

In the body:

<div class=&quot;look&quot;>&nbsp;<img src=&quot;/images/fold.jpg&quot; class=&quot;folding&quot;>
<img src=&quot;/images/Services.jpg&quot; class=&quot;folding&quot;>
<ul class=&quot;look2&quot; style=&quot;list-style-image:url(/images/list.jpg);display:none&quot;>
<li><a href=&quot;fdddf&quot;>Link 2a</a></li>
<li><a href=&quot;fdddf&quot;>Link 2b</a></li>
<li><a href=&quot;fdddf&quot;>Link 2c</a></li>
</ul>
</div>

Can anyone help?? Otherwise, can anyone direct me to a script that will work in both Netscape & IE?
Thanks!
 
I'm pretty sure that Netscape doesn't support document.all.

This is an IE only spec. You'll have to look around for one that is cross-compatible. There's always a better way...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top