Access a radio button "Checked" property on the client side.

B

bredal Jensen

I'm dynamiccaly creating radion buttuns. I need to respond to users
selction.
and generate a posback to the server . How can i do this?


Any comment will be appreciated..


Jensen
 
V

Vidar Petursson

Hi

var e = document.forms["FORMNAME"].RADIONAME;

if(e.length != "undefined")
{
for(i=0;i<e.length;i++)
{
if(e.checked ) doSomething(e);
}
}

Or maybe

var e = document.forms["FORMNAME"].elements;
var r;
for(i=0;i<e.length;i++)
{
if(e.type == "radio")
{
r = e;// You may want to check for undefined length on some
browsers.. ( only 1 radio )
for(a=0;a<r.length;a++)
{
if(r[a].checked ) doSomething(r[a]);
}
}
}

More info
http://msdn.microsoft.com/library/d...hor/dhtml/reference/dhtml_reference_entry.asp

--
Best Regards
Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.microsoft.com/technet/scriptcenter
==============================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top