我在这个论坛中搜索并尝试了这里解释的不同方式,我尝试了一切但我遇到了这个问题,正如你所看到的我尝试了不同的方式,该功能向我显示警报....但没有隐藏或显示任何内容,我不知道为什么:/
<script type="text/javascript">
function show(valor) {
var zona1=document.getElementById("zona");
var b=document.getElementById("barrioscf");
var part=document.getElementById("partidos");
if (valor==1) {
/* b.style.visibility='visible';
part.style.visibility='hidden';
*/
b.style.display = 'block';
part.style.display = 'none';
alert ("entro if 1");
//document.all.form_crea.barrioscf.style.visibility="visible"
//document.all.form_crea.p.style.visibility="hidden"
} else if(valor==2) {
b.style
b.style.display = 'none';
part.style.display = 'block';
alert ("entro if 2");
/* b.style.visibility="hidden";
part.style.visibility="visible";*/
//document.all.form_crea.barrioscf.style.visibility="hidden"
//document.all.form_crea.p.style..visibility="visible"
}
}
</script>
<select id="zona" name="zona_nombre"
onChange="javascript:mostrar_barrios(this.value);">
<option value="1">Capital Federal</option>
<option value="2">Gran Buenos Aires</option>
</select>
<tr><td>Barrios:
<td>
<select id="barriocf"name="barriocf" >
<?
while ($row = mysql_fetch_row($result)) {
echo "<option value='".$row['0']."'>".$row['1']."</option>";
}
mysql_free_result($result);
?>
</select>
<tr id="partidos">
<td>Partidos:
<td>
<select id="p"name="partido" style="visibility:hidden">
<option value="Avellaneda">Avellaneda</option>
</select>