gpt4 book ai didi

javascript - YUI 中的 onChange

转载 作者:搜寻专家 更新时间:2023-11-01 05:16:13 25 4
gpt4 key购买 nike

我们如何在 YUI 2 和 YUI3 中为 onChange 函数编写代码。

jQuery(':input[type=radio]').change(function(){

var aType=jQuery(this).val();
var numT= aType==1 ? "3" : "6" ;
var aWidth=aType==1 ? "330px" : "660px" ;

});

最佳答案

在 YUI 3 中

Y.all('input[type=radio]').each(function (node) {
node.on('change', function () {
var val = this.get('value');
...
});
});

// or
Y.all('input[type=radio]').on('change', function (e) {
var val = e.currentTarget.get('value');
...
});

在 YUI 2.9 中(不再积极开发;使用 YUI 3)

// typical implementations alias Event or Event.on and
// Selector.query to shorter names
YAHOO.util.Event.on(
YAHOO.util.Selector.query('input[type=radio]'), 'change', function (e) {
var val = this.value;
...
});

关于javascript - YUI 中的 onChange,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7039787/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com