View Full Version : [HTML] Form come questo...
cicoandcico
20-02-2005, 16:31
Come posso fare in html un form come questo? ho provato e riprovato ma non mi riesce di rendere inattivi i campi relativi a un radio button quando seleziono l'altro.
anonimizzato
20-02-2005, 17:26
per farlo devi utilizzare un linguaggio di scripting come Javascript o anche PHP, l'html da solo non basta.
massmagic
20-02-2005, 19:23
<script language="javascript">
function abilita()
{
document.getElementById('tr_start_ip').disabled = false;
document.getElementById('tr_end_ip').disabled = false;
document.getElementById('tr_pdns').disabled = false;
document.getElementById('tr_leasetime').disabled = false;
document.getElementById('rbt_disable').checked = false;
}
function disabilita()
{
document.getElementById('tr_start_ip').disabled = true;
document.getElementById('tr_end_ip').disabled = true;
document.getElementById('tr_pdns').disabled = true;
document.getElementById('tr_leasetime').disabled = true;
document.getElementById('rbt_enable').checked = false;
}
</script>
<form action="pagina.asp" method="post">
<table border="0">
<tr>
<td>
<input type="radio" id="rbt_enable" name="rbt_enable" onclick="return abilita();"> Enable DHCP Server
</td>
<td>
</td>
<td>
</td>
</tr>
<tr id="tr_start_ip" disabled>
<td>
</td>
<td>
Start IP
</td>
<td>
<input type="text" id="start_ip" name="start_ip" value="192.168.0.1">
</td>
</tr>
<tr id="tr_end_ip" disabled>
<td>
</td>
<td>
End IP
</td>
<td>
<input type="text" id="end_ip" name="end_ip" value="192.168.0.255">
</td>
</tr>
<tr id="tr_pdns" disabled>
<td>
</td>
<td>
Primary DNS
</td>
<td>
<input type="text" id="pdns" name="pdns" value="192.168.0.2">
</td>
</tr>
<tr id="tr_leasetime" disabled>
<td>
</td>
<td>
Lease Time
</td>
<td >
<input type="text" id="leasetime" name="leasetime" value="2500"> Seconds
</td>
</tr>
<tr>
<td>
<input type="radio" id="rbt_disable" name="rbt_disable" onclick="return disabilita();" checked> Disable DHCP Server
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input type="submit" value="Modifica">
</td>
</tr>
</table>
</form>
ecco qui :D
cicoandcico
20-02-2005, 20:26
grandissimi :) grazie mille
:D :D :D
massmagic
21-02-2005, 02:36
ho aggiornato il codice ora dovrebbe disabilitare l'intera tr cosė da far diventare disabilitato anche il testo accanto alle input-text
bye bye
vBulletin® v3.6.4, Copyright ©2000-2026, Jelsoft Enterprises Ltd.