![]() |
| |||||||
| Sponsored Links |
![]() |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| |||
| |||
| Hi, Is there easy way to dispaly the value of a radio button when it is clicked? Thanks, theChris Last edited by richyrich; May 6th, 2008 at 11:58 AM. Reason: Removed [SOLVED] from title |
| Sponsored Links |
|
#2
| ||||
| ||||
| You can have such code: Code: <script language="javascript" type="text/javascript">
<!--
function displayValue()
{
for (var i = 0; i < document.form1.radiobut.length; i++)
{
if (document.form1.radiobut[i].checked)
{
var display = document.form1.radiobut[i].value;
alert(display);
}
}
}
//-->
</script>
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.If you like it here...throw us a few bones to help support us. Join our Folding team: DeveloperBarn Folding |
|
#3
| ||||
| ||||
| Not quite sure what you want to do--display something to the user when he/she selects one choice among several? Would this be to confirm that the choice has been made? Usually just the black dot in the option selected is taken as the indication that the choice has been made. Or am I missing your point? |
|
#4
| |||
| |||
| Quote:
|
|
#5
| ||||
| ||||
| Quote:
yes...if simply wanting to debug then you can use inline code HTML Code: <html> <head> <title>Javascript onclick Radio Button Demo</title> </head> <body> <form action="page.htm" method="post"> <fieldset> <legend>Gender</legend> <table> <tr> <td>Male</td> <td><input type="radio" name="gender" value="Male" onclick="alert(this.value);"></td> </tr> <tr> <td>Female</td> <td><input type="radio" name="gender" value="Female" onclick="alert(this.value);"></td> </tr> </table> </fieldset> </form> </body> </html> |
|
#6
| |||
| |||
| Thanks guys, both solutions worked |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|