Ciao a tutti...
Ho questo codice e cerco di far visualizzare il valore che contiene hs. come posso fare???
Inoltre il modo con cui ho attribuito il valore alla variabile appoggio è corretto??
codice:
var prev= null;
var prev= null;
//var appoggio= $_SESSION['menu'];
window.onload=function(){
if(document.getElementsByTagName && document.getElementById){
document.getElementById("nav").className="jsenable";
BuildList();
}
}
function BuildList(){
var hs=document.getElementById("nav").getElementsByTagName("h3");
for(var i=0;i<hs.length;i++){
hs[i].onclick=function(){
if(this.parentNode.text='Accettazione'){
if(this.parentNode.className!="show"){
this.parentNode.className="show";
if(prev && prev!=this.parentNode) prev.className="hide";
prev=this.parentNode;
}
else this.parentNode.className="hide";
}
}
}
window.onload=function(){
if(document.getElementsByTagName && document.getElementById){
document.getElementById("nav").className="jsenable";
BuildList();
}
}
function BuildList(){
var hs=document.getElementById("nav").getElementsByTagName("h3");
for(var i=0;i<hs.length;i++){
//if(hs[i]==appoggio){
hs[i].onclick=function(){
//document.write(hs[i].nodeValue);
if(this.parentNode.text='Accettazione'){
if(this.parentNode.className!="show"){
this.parentNode.className="show";
if(prev && prev!=this.parentNode) prev.className="hide";
prev=this.parentNode;
}
else this.parentNode.className="hide";
}
}
}
}
Grazie
Sara