有没有大神帮我看看这段程序哪里有问题?为啥我点加减都没有效果
num.onclick = function (e) {
e = e || window.event;
var el = e.srcElement;
var cls = el.className;
var input = this.getElementsByTagName('input'); //取得input的值
var val = parseInt(input.value);
var reduction = this.getElementsByClassName('reduction');
switch (cls) {
case 'plus':
input.value=val+1;
break;
case 'reduction':
input.value=val-1;
break;
default:
break;
}
}