E' un pò che provo, e per ora son arrivato a questa soluzione:
Questo è il file iemenu.js, che inserisco in tutte le pagine cosi: <script type="text/javascript" src="iemenu.js"></script>
Questo invece è gallery.js, che inserisco nelle pagine della fotogallery cosi: <script type="text/javascript" src="gallery.js"></script>codice:startList = function() { if (document.all&&document.getElementById) { navRoot = document.getElementById("nav"); for (i=0; i<navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onmouseover=function() { this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace(" over", ""); } } } } } window.onload=startList;
è vero che cosi ho due volte window.onload ecc ecc, però cosi con due soli file e senza inserir markup aggiuntivo e diverso da pagina a pagina sembra funzionare tutto!codice:// window.onload=function(){ function fotogalleria(){ if(!document.getElementById || !document.getElementsByTagName) return; links=document.getElementById("galleria").getElementsByTagName("a"); for(i=0;i<links.length;i++) links[i].onclick=function(){Show(this);return(false)} } function Show(obj){ bigimg=document.getElementById("bigimage"); bigimg.src=obj.getAttribute("href"); smallimg=obj.getElementsByTagName("img")[0]; t=document.getElementById("titolo"); t.removeChild(t.lastChild); t.appendChild(document.createTextNode(smallimg.title)); } window.onload=function() {startList();fotogalleria();}
Che dite, può andare o sto facendo qualche scemenza??

Rispondi quotando