|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I don't know JavaScript so I havn't been able to figure this out, sorry. What I need to do is whenever someone selects a radio button, a value is changed in a text input.
In the example form code below, when the user selects a radio button, the value of the text input needs to change. It sounds easy, but I can't figure it out. Thanks, Patrick <INPUT TYPE="text" NAME="dat_file"> <INPUT TYPE="radio" NAME="txt_file" VALUE="file_1.txt"> File 1<BR> <INPUT TYPE="radio" NAME="txt_file" VALUE="file_2.txt"> File 2<BR> <INPUT TYPE="radio" NAME="txt_file" VALUE="file_3.txt"> File 3<BR> |
|
#2
|
||||
|
||||
|
there are 2 ways to skin this cat - this is my preffered option.
<html><head> <script> function rad(txt){document.fname.dat_file.value=txt;} </script></head> <body bgcolor="#ffffff"> <form name=fname> <INPUT TYPE="text" NAME="dat_file"> <INPUT TYPE="radio" NAME="txt_file" VALUE="file_1.txt" onclick="rad('whatever you want here')"> File 1<BR> <INPUT TYPE="radio" NAME="txt_file" VALUE="file_2.txt" onclick="rad('maybe you want this?')"> File 2<BR> <INPUT TYPE="radio" NAME="txt_file" VALUE="file_3.txt" onclick="rad('nah! this is nicer')"> File 3<BR> </form> </body></html> Regards, ------------------ Simon Wheeler FirePages -DHTML/PHP/MySQL |
|
#3
|
|||
|
|||
|
Cool, thanks for the help. Seems simple now that I look at it, but I wasn't having any luck on my own.
Thanks, Patrick |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Automaticly set value of text input? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|