ciao! Ho 3 bottoni radio: devo visualizzare il valore di quello ceccato in un campo di testo. é possibile?
ciao! Ho 3 bottoni radio: devo visualizzare il valore di quello ceccato in un campo di testo. é possibile?
si è possibile,
All'evento onClick del radio button,
richiami una funzione oppure direttamente una linea di codice
Onclick="javascript:nomefunzione(this)";
function nomefunzione(param)
{
document.forms[0].CampoDiTesto.value=param.value;
}
........‘’’........
.......(o o).......
----ooO-(_)-Ooo----
con questo non riporta nulla: dove sbaglio? :master:codice:<html> <head> <script> function nomefunzione(param) { document.forms[0].testo.value=param.value; } </script> </head> <body> <form name=forms method=post> <input type="radio" Name="k" value="1" onClick="nomefunzione">1 <input type="radio" Name="k" value="2" onClick="nomefunzione">2 <input type="radio" Name="k" value="3" checked="true" onClick="nomefunzione">3 <input type=text name=testo> <input type=submit value=invia> </form> </body> </html>
codice:<html> <head> <script> function filltext(param) { //alert(param.value); document.forms[0].campo.value=param.value; } </script> </head> <body> <form name=fname method=post> <input type=radio name=radioname value=0 Onclick=" filltext(this)"> <input type=radio name=radioname value=1 Onclick=" filltext(this)"> <input type=radio name=radioname value=2 Onclick=" filltext(this)"> <form> <input type=text name=campo> </body> </html>
........‘’’........
.......(o o).......
----ooO-(_)-Ooo----
ora funzionagrazie
codice:<html> <head> <script> function fu(hhh) { document.forms[0].valore.value=hhh.value; } </script> </head> <body> <form name=aa method=GET> <input type=radio name="nome" value="1" Onclick=" fu(this)"> <input type="radio" name="nome" value="2" Onclick=" fu(this)"> <input type="radio" name="nome" value="3" Onclick=" fu(this)"> <form> <input type="radio" name="ee" size="31"> </body>
opsss scusate....avete già risolto
ho anche fatto un errore molto ..![]()
codice:<html> <head> <script> function fu(hhh) { document.forms[0].ee.value=hhh.value; } </script> </head> <body> <form name=aa method=GET> <input type="radio" name="nome" value="1" Onclick="fu(this)"> <input type="radio" name="nome" value="2" Onclick="fu(this)"> <input type="radio" name="nome" value="3" Onclick="fu(this)"> <form> <input type="text" name="ee" size="31"> </body>