This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

selecting a radio button for IE & Netscape

 
ritchie diputado
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you set the selection of the radio button that work both for IE and Netscape.
<form name="forname" action="any.do">
<input type="radio" name="obj" id="objID" value="0"></html:radio >
<input type="radio" name="obj" id="objID" value="1"></html:radio >
<input type="radio" name="obj" id="objID" value="2"></html:radio >
</form >

scenario: current selected radio is 0, i want to change the selection to 2 "changeRadio(2)"
thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the HTML or under Javascript control? And what version of Netscape? The answers you'll get will vary greatly with these answers.
bear
 
ritchie diputado
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Under javascript control. I want this to be as much as posible cross browser.
thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reference document.formname.obj will reference the radio group. This is a collection of the radio buttons.
So the following:

will set the second radio button as the selected button. (Note that this is an array index and has nothing to do with the values of the buttons).
hth,
bear
P.S. I know that this will work in all modern browsers.
[ September 23, 2003: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic