【问题标题】:YUI Radiobutton ASP.Net oncheckedchangedYUI 单选按钮 ASP.Net oncheckedchanged
【发布时间】:2011-02-23 16:25:51
【问题描述】:

我正在使用 YUI 框架来设置单选按钮的样式,并希望使用 oncheckedchanged 事件重定向到另一个页面。它适用于传统的单选按钮,但与 YUI 框架一起使用时,oncheckedchanged 事件永远不会触发。几乎就好像 YUI 有一个内置函数来代替它。有什么解决方法吗?

【问题讨论】:

    标签: asp.net yui radio-button oncheckedchanged


    【解决方案1】:

    所以 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
    

    【讨论】:

    • 谢谢!与此同时,我已将它们替换为复选框以独占操作并有一个 onclick 按钮。
    • 您知道如何将单选按钮组中的按钮标签替换为其他内容吗?我将 id 定义为 Some_ID,但我希望按钮显示为“Some ID”。用常规 javascript 替换会更改其 id 而不是标签。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-03
    • 2011-01-25
    • 1970-01-01
    • 1970-01-01
    • 2011-05-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多