View Full Version : onChange... make radio CHECKED

07-13-2005, 03:05 AM
Okay.. I have looked around a bit to find what I'm looking for but can't (or more to the point I'm too buggered, 18 hours scripting and I'm over it!)

This is a simple thing I'm sure.. but I'm just a PHP-er.. thats my excuse and I'm sticking to it! lol

Here is what I want:

My form:

<table cellspacing=1 cellpadding=3 bgcolor=black width=95%>
<td colspan=2 class=boxtitle align=center>Create Team</td>
<tr><form method='post' name='regteam'>
<td class=tlist1 align=center><input type=radio name=newteam value=new CHECKED> Start New Team: <input type=text name=newtname maxlength=50 size=30><br/>
<input type=radio name=newteam value=join> Join A Team: <select name=jid>$jointeambox</select><br/><br/>
Team Password: <input type=text name=password maxlength=10>
<td colspan=2 class=boxtitle align=center><input type=submit name=submit value='Create Team'></td>

NOTE: $jointeambox is my PHP variable of the options for select.

What I need is when someone changes the select box, that the radio button beside it becomes checked. I know I'll need onChange.. but not sure how to write whats needed to make the radio checked.

Thanks in advance for any help! :thumbsup:

Willy Duitt
07-13-2005, 03:40 AM
onchange="if(this.value)this.form['newteam'][1].checked=1;else this.form['newteam'][1].checked=0"