Sto provando a mettere come ID un nome alfanumerico, ma mi da errore.
Ecco il codice:
Codice PHP:
$catID = "categoria_". $rstcateg['idc'];
echo "<a href=\"#$catID\" onclick=\"categ($catID, this);\">$rstcateg[nome]</a>
";
echo "<a id=\"$catID\" style=\"display:none;\">";
Id il codice JS:
codice:
function categ(cat, check){
if(document.getElementById(cat).style.display == "none"){
document.getElementById(cat).style.visibility = "visible";
document.getElementById(cat).style.display = "";
}
else{
document.getElementById(cat).style.visibility = "hidden";
document.getElementById(cat).style.display = "none";
}
}
Mi dice sempre: "Neccessario Oggetto"
Che c'è che non va?