<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Value="-1" onchange="clear()">学生</asp:ListItem>
<asp:ListItem Value="0">教师</asp:ListItem>
</asp:RadioButtonList>
而他生成的html则是
<table id="RadioButtonList1" border="0">
<tr>
<td><span onchange="clear()"><input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="-1" /><label for="RadioButtonList1_0">学生</label></span></td><td><input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="0" /><label for="RadioButtonList1_1">教师</label></td>
</tr>
</table> 怎样来正确添加js onchange="clear()"事件
谢谢
<asp:ListItem Value="-1" onchange="clear()">学生</asp:ListItem>
<asp:ListItem Value="0">教师</asp:ListItem>
</asp:RadioButtonList>
而他生成的html则是
<table id="RadioButtonList1" border="0">
<tr>
<td><span onchange="clear()"><input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="-1" /><label for="RadioButtonList1_0">学生</label></span></td><td><input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="0" /><label for="RadioButtonList1_1">教师</label></td>
</tr>
</table> 怎样来正确添加js onchange="clear()"事件
谢谢
解决方案 »
- 如何在界面刷新之后调用一个函数
- 用在“三层”的那一层
- windows services 1053服务没有及时响应或控制请求
- 通过数据库表的字段限制IP段打开网页里的文件,求一段代码
- 关于文件上传问题
- 用PagedDataSource 分页时报"无法计算未实现 ICollection 的数据源中的计数"的异常
- 用了ajax我什么还要刷新
- CSS问题:我用div+css构造了一个表的样式,其中的div代码比较多,表的样式用得也多,能不能能这些div代码也嵌入CSS,调用时只用少量代码?
- 紧急求助 ,水晶报表无法显示
- DATAGRID
- 请问C#中的缓存跟session有什么区别
- 关于使用window.showModalDialog调出模式窗口的问题!请指教!
RadioButtonList1.Attributes.Add("onchange", "clear()");
<asp:ListItem Value="-1" onclick="javascript:clear1()" >学生</asp:ListItem>
<asp:ListItem Value="0">教师</asp:ListItem>
</asp:RadioButtonList> <script type="text/javascript">
function clear1()
{
alert("点击了.");
}
</script>
{
RadioButtonList1.Items[ix].Attributes.Add("onchange", "clear();");
}
if(document.getElementById("<%= rbl_Object.ClientID %>"+"_1").checked)
这里是判断是否选中的
虽然这样可以
但不知道有没有更好的写法