Salve,

Al momento sto usando questo vecchio javascript per un menù a comparsa che quando si clicca su un link fa apparire degli altri link sotto di esso.

Questo è il codice:

script1.js
codice:
var bV=parseInt(navigator.appVersion);
NS4=(document.layers)?true:false;
IE4=(document.all)?true:false;
ver4=(NS4 || IE4)?true:false;
if (document.images) {
arImLoad=new Array ("down.gif");
arImList=new Array ("down2.gif");
for (counter in arImLoad) {
arImList[counter]=new Image();
arImList[counter].src=arImLoad[counter] + ".gif";
}}
function expandIt(){return}
function expandAll(){return}
script2.js
codice:
isExpanded=false;
function reDo(){
window.location.reload() }
function getIndex(el) {
ind=null;
for (i=0; i<document.layers.length; i++) {
whichEl=document.layers[i];
if (whichEl.id==el) {
ind=i;
break; }}
return ind;        }
function arrange() {
nextY=document.layers[firstInd].pageY + document.layers[firstInd].document.height-10;
for (i=firstInd+1; i<document.layers.length; i++) {
whichEl=document.layers[i];
if (whichEl.visibility != "hide") {
whichEl.pageY=nextY;
nextY += whichEl.document.height-10; }}}
function initIt() {
if (NS4) {scrollTo(0,pageYOffset-10)
for (i=0; i<document.layers.length; i++) {
whichEl=document.layers[i];
if (whichEl.id.indexOf("Child") != -1) {
whichEl.visibility="hide";
whichEl.isExpanded=false; }}
arrange();
setTimeout("window.onresize=reDo",1000) }
else {
tempColl=document.all.tags("DIV");
for (i=0; i<tempColl.length; i++) {
if (tempColl(i).className == "child") {
tempColl(i).style.display="none";
tempColl(i).isExpanded=false; }}}}
function expandIt(el) {
if (!ver4) return;
if (IE4) {expandIE(el)} else {expandNS(el) }}
function expandIE(el) {
whichEl=eval(el + "Child");
whichIm=event.srcElement;
if (whichEl.style.display == "none") {
whichEl.style.display="block";
whichEl.isExpanded=true;
whichIm.src="down.gif"; }
else {
whichEl.style.display="none";
whichEl.isExpanded=false;
whichIm.src="down2.gif"; }}
function expandNS(el) {
whichEl=eval("document." + el + "Child");
whichIm=eval("document." + el + "Parent.document.images['imEx']");
if (whichEl.visibility == "hide") {
whichEl.visibility="show";
whichEl.isExpanded=true;
whichIm.src="down.gif"; }
else {
whichEl.visibility="hide";
whichEl.isExpanded=false;
whichIm.src="down.gif"; }
arrange(); }
function showAll() {
for (i=firstInd; i<document.layers.length; i++) {
whichEl=document.layers[i];
whichEl.visibility="show"; }}
function expandAll(isBot) {
newSrc=(isExpanded)?"down.gif":"down2.gif";
if (NS4) {
document.images["imEx"].src=newSrc;
for (i=firstInd; i<document.layers.length; i++) {
whichEl=document.layers[i];
if (whichEl.id.indexOf("Parent") != -1)        {
whichEl.document.images["imEx"].src=newSrc;        }
if (whichEl.id.indexOf("Child") != -1) {
whichEl.visibility=(isExpanded)?"hide":"show";
whichEl.isExpanded=(isExpanded)?false:true;        }}
arrange();
if (isBot && isExpanded) scrollTo(0,document.layers[firstInd].pageY);}
else { divColl=document.all.tags("DIV");
for (i=0; i<divColl.length; i++) {
if (divColl(i).className == "child") {
divColl(i).style.display=(isExpanded)?"none":"block";
divColl(i).isExpanded=(isExpanded)?false:true;}}
imColl=document.images.item("imEx");
for (i=0; i<imColl.length; i++) {
imColl(i).src=newSrc;}}
isExpanded=!isExpanded;}
function linkIt(whichEl, whichHref)        {
lay=(NS4)?eval("document."+whichEl+"Child"):eval(whichEl+"Child");
if (!lay.isExpanded) expandIt(whichEl);
nlay=(NS4)?lay.document.images[whichHref]:document.images[whichHref];
if (NS4) {
sY=nlay.y+lay.pageY-20
window.scrollTo(0,sY);}
else{nlay.scrollIntoView();scroll(0,document.body.scrollTop-2);
nlay.parentElement.style.backgroundColor="#FF99FF";setTimeout("nlay.parentElement.style.backgroundColor='white'",1000);}}
window.onload=initIt;
e questo è un link di esempio:

codice:
<div class=parent id=elOneParent>Sezione</div>
      <div class=child id=elOneChild> 
        

        - Argomento 1

        - Argomento 2

        - Argomento Cd 3

      </div>
inoltre nel foglio di stile per i div della classe child c'è aggiunta l'opzione "display:none;"
Ora questo Codice funziona su Internet Explorer anche se mi viene chiesto di permettere al sito di utilizzare controlli ActiveX mentre su Firefox non funziona in alcun modo. Tral'altro ho l'impressione che buona parte dello script sia inutile ai fini di quello che voglio fare io e quindi occupi solo spazio, memoria e tempo di download dello script.

Esiste uno script che faccia lo stesso ma che sia compatibile con Firefox, o meglio ancora se ci siano delle modifiche che si possono fare su questo stesso script per renderlo compatibile?