This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes HTML, CSS and JavaScript and the fly likes selecting a radio button for IE & Netscape Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "selecting a radio button for IE & Netscape" Watch "selecting a radio button for IE & Netscape" New topic
Author

selecting a radio button for IE & Netscape

ritchie diputado
Greenhorn

Joined: Sep 19, 2003
Posts: 5
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

Joined: Jan 10, 2002
Posts: 61084
    
  66

In the HTML or under Javascript control? And what version of Netscape? The answers you'll get will vary greatly with these answers.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ritchie diputado
Greenhorn

Joined: Sep 19, 2003
Posts: 5
Under javascript control. I want this to be as much as posible cross browser.
thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61084
    
  66

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 ]
 
wood burning stoves
 
subject: selecting a radio button for IE & Netscape