Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
80
rated 0 times [  81] [ 1]  / answers: 1 / hits: 15545  / 11 Years ago, tue, april 16, 2013, 12:00:00

I am newbie to java script and trying to achieve the following and was looking for suggestions:



Create two radio buttons and whenever we select on radio button it should navigate to some URL like in the below example XYZ.com or ABC.com



<html>
<table width=450>
<tr>
<td style=background-color:#FFFFFF;><h4>Choose a Field</h4></td>
</tr>
</table></br>
<form action=../>
<fieldset>
<input type=RADIO value=http://xyz.com name=userChoice id=navRadio01>
<label for=navRadio01>XYZ</label><br>
<input type=RADIO value=http://abc.com name=userChoice id=navRadio02 checked>
<label for=navRadio02>ABC</label><br>
<input type=BUTTON value=Go onclick=ob=this.form.userChoice;for(i=0;i<ob.length;i++){
if(ob[i].checked){window.open(ob[i].value,'_self');};} style=color:#FFFFF;background-color:#E0E0E5;font-family:verdana;border-style:solid; />
</fieldset>
</form>
</html>


I have used the Go button in the above example how can we do this, without using the Go button and once selected navigate to that link.?



Please advice.



Thank you all in advance.



-
V


More From » html

 Answers
6

Have a look here:



Calling onclick on a radiobutton list using javascript



There's a bit of a debate and then a full example at the bottom.


[#78867] Monday, April 15, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
joanneamiyaa

Total Points: 532
Total Questions: 127
Total Answers: 98

Location: Guam
Member since Tue, Nov 3, 2020
4 Years ago
;