在YUI中的onChange [英] onChange in YUI
本文介绍了在YUI中的onChange的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们如何在YUI 2和YUI3中为onChange函数编写代码。
How we can write code for onChange function in YUI 2 and YUI3.
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)
In YUI 2.9 (which is no longer under active development; use 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;
...
});
这篇关于在YUI中的onChange的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文