【发布时间】:2011-02-23 16:25:51
【问题描述】:
我正在使用 YUI 框架来设置单选按钮的样式,并希望使用 oncheckedchanged 事件重定向到另一个页面。它适用于传统的单选按钮,但与 YUI 框架一起使用时,oncheckedchanged 事件永远不会触发。几乎就好像 YUI 有一个内置函数来代替它。有什么解决方法吗?
【问题讨论】:
标签: asp.net yui radio-button oncheckedchanged
我正在使用 YUI 框架来设置单选按钮的样式,并希望使用 oncheckedchanged 事件重定向到另一个页面。它适用于传统的单选按钮,但与 YUI 框架一起使用时,oncheckedchanged 事件永远不会触发。几乎就好像 YUI 有一个内置函数来代替它。有什么解决方法吗?
【问题讨论】:
标签: asp.net yui radio-button oncheckedchanged
所以 YUI 替换了一些类似于 <span><span><button /></span></span> 的 html 的 <input type='radio'...
因此,无论您为 oncheckedchanged 事件附加什么功能,您可能都必须使用 YUI 的 api 将其附加为单击或更改事件,所以它看起来像这样。
var buttonGroup = new YAHOO.widget.ButtonGroup("radiogroup"); //init buttons
var buttons = buttonGroup.getButtons(); //get the buttons
buttons[0].on('click', function(){alert('a');}); //attach event, you probably need to iterate the buttons array to attach events to all the buttons
【讨论】: