Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting a Radio Button by code?

Status
Not open for further replies.

adamthenewbie

Programmer
Mar 15, 2005
5
CA
I have these 4 radio buttons
<input type="radio" name="branch" value="nb" checked> NB
<input type="radio" name="branch" value="ns"> NS
<input type="radio" name="branch" value="none"> Non Member
<input type="radio" name="branch" id = "branch" value="other"> <input class = "textbox2" type="text" name="other_branch" value = "<? echo $other_branch; ?>" size="10" onFocus="java script: selectOther();" />

The last radio button I want it to be selected if the user clicks on the TExt Area beside it.

So I have this function which gets called onFocus

<script language="JavaScript">
<!--
function selectOther() {
document.forms[0].branch.checked;
}
//-->
</script>

What is the proper code to select the radio button?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top