Click to See Complete Forum and Search --> : navigation script uncompatable


xaviorg
03-08-2003, 03:41 PM
the following script is for a dropdown navigation tree, is it possible to make it compatable with all browsers?

menu.js
<!--
var ns6 = document.getElementById && !document.all ? 1 : 0
var folder = ''

function expand(curobj) {
folder = ns6 ? curobj.nextSibling.nextSibling.style : document.all[curobj.sourceIndex + 1].style

if (folder.display == "none")
folder.display = ""
else
folder.display = "none"

return 0
}

function doNothing() {
return
}
//-->


html file
<a href="javascript:doNothing()" onclick="javascript:expand(this)" class="header">Example Header1</a>
<div style="display: none;">
<a href="info.php" class="link">Example Link</a><br />
<a href="info.php" class="link">Example Link</a><br />
<a href="info.php" class="link">Example Link</a><br />
<a href="info.php" class="link">Example Link</a><br />
</div>


any help is greatly appreciated

khalidali63
03-08-2003, 04:02 PM
The code seems to work for both IE6+ and NS6+..

Khalid

xaviorg
03-08-2003, 04:28 PM
yeah i know, but what about older versions, and Mozilla, and other browsers, like Opera and the other Linux browsers (someone else told me it should work with those also) but im not completely sure

khalidali63
03-08-2003, 04:32 PM
NS6+ browsers are based on mozilla,as far as I am aware of most of the popular browsers for Unix/Linux are Mozilla based(including NS) ,Opera's newer versions do comply with DOM1 andd CSS1 specs,therefore you are ok there,the only problem will be NS browsers <5 versions.

Is that worth the effort?

Khalid

xaviorg
03-08-2003, 04:35 PM
well, i dont think NS<5 compatibilty would hurt

xaviorg
03-08-2003, 05:31 PM
ok, ive got this to add to it:

addition to menu.js
var ns4 = document.layers ? 1 : 0


where do i go from here?

khalidali63
03-08-2003, 05:39 PM
You do not have to worry about NS <5 browsers at all.The code you already have should be sufficient...

Cheers

Khalid

xaviorg
03-08-2003, 05:42 PM
thank you very much for you help :D

Cheers to you as well!

xaviorg
03-08-2003, 07:49 PM
any ideas how i can make a function that will close any open folder when you open another folder?