you will need the onmousedown javascript event. The visual studio IDE will tell you that it doesn't exist, but when your page is rendered out as html,
the radio button will become a 'input' and it will have the correct event attached on the client side.
KBrocksi_SEC
Contributor
3382 Points
627 Posts
Re: How to Use Javascript with ASP RadioButton?
Mar 19, 2007 02:13 PM|LINK
Hi SPPatel,
you will need the onmousedown javascript event. The visual studio IDE will tell you that it doesn't exist, but when your page is rendered out as html,
the radio button will become a 'input' and it will have the correct event attached on the client side.
Something like this...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>test</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <script type="text/javascript"> function clickCheck(obj) { if (obj.checked) { alert("Already checked"); } } </script> <style type="text/css"></style> </head> <body> <input type="radio" onmousedown="clickCheck(this)" name="Radio1" /><br /> <input type="radio" name="Radio2" /> </body> </html>