<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal" οnclick="javascript:radioListSelectedChanged();">
<asp:ListItem Value="1" >是</asp:ListItem>
<asp:ListItem Value="0" >否</asp:ListItem>
</asp:RadioButtonList>
<asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" >
</asp:CheckBoxList>
$(document).ready(function()
{
var radioBtnList1=document.all("RadioButtonList1");
var txt=document.all("txt1");
var checklist=document.all("CheckBoxList_uploadFileType");
var item0=radioBtnList1.cells[0].getElementsByTagName("input")[0];//注意对象的取法,可跟踪察看
if((item0!=null)&&(item0.checked==true))//选择“是”
{
txt.disabled=false;
var checklist=document.getElementById("<%=CheckBoxList1.ClientID%>");
if(checklist==null) return;
for(var i=0;i<document.getElementById("CheckBoxList1").getElementsByTagName("input").length;i++)
{
var temp=document.getElementById("CheckBoxList1").getElementsByTagName("input")[i];
temp.disabled=false;
}
}
else
{
txt.disabled=true;
txt.value="";
var checklist=document.all("CheckBoxList1");
if(checklist==null) return;
for(var i=0;i<document.getElementById("CheckBoxList1").getElementsByTagName("input").length;i++)
{
var temp=document.getElementById("CheckBoxList1").getElementsByTagName("input")[i];
temp.disabled=true;
temp.checked=false;
}
}
//页面是否提交成功
var opResultType=document.getElementById("<%=HiddenField_opResultType.ClientID%>");//服务器端提交控件的事件中赋值
switch(opResultType.value)
{
case "as":
alert('成功添加!');
break;
case "us":
alert('成功更新!');
break;
case "af":
alert('失败!');
break;
case "uf":
alert('失败!');
break;
default:
break;
}
}
)
function radioListSelectedChanged()
{
//debugger;
var radioBtnList1=document.all("RadioButtonList1");
var txt=document.all("txt1");
if(radioBtnList1!=null)
{
var item0=radioBtnList1.cells[0].getElementsByTagName("input")[0];//注意对象的取法,可跟踪察看
if((item0!=null)&&(item0.checked==true))//选择“是”
if(item0.checked)//是
{
txt.disabled=false;
var checklist=document.getElementById("<%=CheckBoxList1.ClientID%>");
if(checklist==null) return;
for(var i=0;i<document.getElementById("CheckBoxList1").getElementsByTagName("input").length;i++)
{
var temp=document.getElementById("CheckBoxList1").getElementsByTagName("input")[i];
temp.disabled=false;
}
}
else
{
txt.disabled=true;
txt.value="";
var checklist=document.all("CheckBoxList1");
if(checklist==null) return;
for(var i=0;i<document.getElementById("CheckBoxList1").getElementsByTagName("input").length;i++)
{
var temp=document.getElementById("CheckBoxList1").getElementsByTagName("input")[i];
temp.disabled=true;
temp.checked=false;
}
}
}
}