[thelist] JS alerts not working for input type=radio buttons
Sharon F. Malone
sfmalo at 24caratdesign.com
Sat Feb 23 07:46:01 CST 2002
Yuriy -
Thanks for your suggestion. The one Andrew provided turned out to be just what worked with my situation as follows:
[snippet]
The group of radio buttons with the same name is accessed as an
array (the first entry is indexed with 0).
if (!theForm.demo[0].checked && !theForm.demo[1].checked)
{
alert("Please click on one of them little round doo-hickeys.");
// You could set focus on the button you think the user is most likely to
click.
// This is helpful for users who hit Enter to "check" radio buttons.
theForm.demo[0].focus();
return false;
}
[/snippet]
Appreciate your input.
Best,
Sharon
From: "Yuriy" <work at avg-team.com>
Sent: Friday, February 22, 2002 3:16 AM
> As i understand you need something like this:
>
> <html>
> <head>
> <script language=javascript>
> function test() {
> if (document.forms[0].radio_1.status==true) alert ("hey-ho!");
> else alert ("nope");
> }
> </script>
> </head>
> <body onClick="javascript:test();">
> <form>
> <input type=radio name="radio_1">
> </Form>
> </body>
> </html>
>
> if this will not help, let me know :-).
---------------------------------------------------------------------------
Sharon F. Malone
"web design and Internet writing services"
http://www.24caratdesign.com
sfmalo at 24caratdesign.com
More information about the thelist
mailing list