John:
Thank you. Perfect!
Ken
On Wed, 31 Dec 2003 01:10:36 GMT, "johkar" <>
wrote:
>When you have a group of radio buttons (I.E. only one can be selected), you
>need to name them the same. The checked value, if any, will be the only one
>returned under that name. Since they are named the same you need to access
>them like so: 1st radio button: document.ViewOptions.Open[0].checked 2nd
>radio button: document.ViewOptions.Open[1].checked
>
>John
>
>"Ken Loomis" <> wrote in message
>news:.. .
>> Hello:
>>
>> On a web page I check the value of a cookie and set one of two radio
>> buttons accordingly.
>>
>> function setRadioForm() {
>> var myCookie = document.cookie;
>> var OpenOnly = myCookie.substring(9);
>> if (OpenOnly == "True") {
>> document.ViewOptions.Open.checked = true;
>> }
>> else {
>> document.ViewOptions.All.checked = true;
>> }
>> }
>>
>> <body onload="setRadioForm()">
>>
>>
>> This works fine. The correct radio button appears checked when the
>> form opens. However, when the user checks one of the buttons (usually
>> the unchecked one), both buttons remain checked.
>>
>> Here's the code on the form:
>>
>> <form name='ViewOptions">
>> <input type="radio" name="Open" value="True"
>> onclick="setCookie("True")> Always, show me open items only.
>> <input type="radio" name="All" value="False"
>> onclick=setCookie("False")>Always show me all items, open and closed.
>> </form>
>>
>> The onclick fires correctly, but the button which was not clicked
>> remains checked. Am I doing something wrong or is this a limitation
>> in the browser/code?
>>
>> --
>> Ken
>>
>>
>>
>>
>>
>
|