File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 61187
    
  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: 61187
    
  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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: selecting a radio button for IE & Netscape