2007年10月29日 星期一

.NET 2.0 RadioButtonList access on the client side using Javascript

The asp:RadioButtonList control will be rendered as a series of input HTML controls wrapped in a span on the client side. To access each element of the RadioButtonList on the client side, use the following codes, whearas id as the ClientID of the RadioButtonList:

var obj = document.getElementById(id);
var radios = obj.getElementsByTagName('input');

Afterwards, radios can be used as an array of radio inputs, which you can access as in normal conditions.

沒有留言: