日期:2014-05-19  浏览次数:20445 次

javascript 点击控件,使另外的控件失效
我在页面中用了两个服务器控件RadioButton,设置的组名相同,我想在点击这其中某个RadioButton时,使另外的服务器控件CheckboxList1失效,要在客户端实现,不能提交服务器进行判断
请问如何实现??

------解决方案--------------------
你可以在你的page_load中写:

string scp = "document.all. "+CheckboxList1.ClientID+ ".disabled=true; ";
theRadioButton1.Attributes[ "onclick "]=scp;
theRadioButton2.Attributes[ "onclick "]=scp;

------解决方案--------------------
.cs代码:
theRadioButton1.Attributes.add( "onclick ", "js() ");

javascrip代码:
function js()
{
document.all.theRadioButton2.disabled=false;
}