SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
Jan 14, 2003, 08:33 #1
- Join Date
- Oct 2000
- Location
- Philadelphia, PA
- Posts
- 4,708
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
click textbox js selects radio button
I am trying to use some javascript on my form. I have three radio buttons. To the right of each radio button is a textbox. If they click in any textbox, I want the radio button to the left of that textbox to be clicked, but the focus needs to stay in the textbox. All three of the radio buttons have the same name, but different values. Anyone have any ideas on how to do this? Thanks...
"Does this napkin smell like chloroform?"
...now with SnapFoo!
My Blog | My Twitter | My Company | SitePoint Podcast
*** Matt Mullenweg on the SitePoint Podcast ***
-
Jan 14, 2003, 09:05 #2
- Join Date
- Oct 2000
- Location
- Philadelphia, PA
- Posts
- 4,708
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
And here is the answer:
<script type="text/javascript">
//text box select and focus
function RDD_Day_setfocus()
{
document.forms[0].RDD_Day.select()
document.forms[0].RDD_Day.focus()
}
//text box select and focus
function RDD_Date_setfocus()
{
document.forms[0].RDD_Date.select()
document.forms[0].RDD_Date.focus()
}
</script>
<input type="radio" name="Radio_Search_RDD" value="Day">
<input onclick="blur();document.FormName.Radio_Search_RDD[0].checked=true;RDD_Day_setfocus()" name="RDD_Day" type="text" value="Yes">
<input type="radio" name="Radio_Search_RDD" value="Date">
<input onClick="blur();document.FormName.Radio_Search_RDD[1].checked=true;RDD_Date_setfocus()" name="RDD_Date" type="text" value = "No">
This post was for my friend, so he finally figured it out."Does this napkin smell like chloroform?"
...now with SnapFoo!
My Blog | My Twitter | My Company | SitePoint Podcast
*** Matt Mullenweg on the SitePoint Podcast ***
Bookmarks