日期:2014-05-18  浏览次数:20468 次

[求助] radiobuttonlist 中的javascript
页面上有一个radiobuttonlist   想做成如下功能:
点击其中一个radiobutton   弹出一个confirm
然后根据confirm的值,到server端控制操作数据库
问题:
1。如何给这个radiobuttonlist   加   js
注:this.radiobuttonlist   .Items[0].Attributes.Add( "onchange ", " ")无效
2。如何在server   端判断confirm   操作的值
希望高手不吝赐教

------解决方案--------------------
你这两个实际是一个问题。

请参考
http://community.csdn.net/Expert/topic/5636/5636969.xml?temp=.1918909
------解决方案--------------------
楼主是这个OnCheckedChanged事件
------解决方案--------------------
1。如果该radiobutton 已经选中,再次点击时,仍会出现onclick事件 ,
===========
即使用 onchange ,难道它就不触发?不触发就不是 change,不对嘛?


this.radiobuttonlist.Items[0].Attributes.Add( "onclick ", "if(!foo(this)) return false; ");


function foo() {
if(this.checked) return confirm( "确定提交? ");
}


2。生成的html中 onchange 事件是有的 不过没有生成到radiobutton 当中,不知道为什么
===========
本身这是 asp.net 内部呈现的问题

3。
实际上html中 input type=radio 是不支持的 onchange 事件的