这个脚本在这里工作https://jsfiddle.net/ByEzF/但在停止工作的站点中:
<script type="text/javascript">
var Add = {
setOptions: function(number) {
$('battle-options')
.removeClass('five-options')
.removeClass('four-options')
.removeClass('three-options')
.removeClass('two-options');
var option3 = $('option-3');
var option4 = $('option-4');
var option5 = $('option-5');
var versus3 = $('versus-3');
var versus4 = $('versus-4');
var versus5 = $('versus-5');
var elements5 = new Elements([option3, option4, option5, versus3, versus4, versus5]);
elements5.setStyle('display','none');
if(number == 5) {
$('battle-options').addClass('five-options');
elements5.setStyle('display','block');
$$('.battle-option input[type="file"]').set('size', 10);
} else if(number == 4) {
$('battle-options').addClass('four-options');
new Elements([option3, option4, versus3, versus4]).setStyle('display','block');
$$('.battle-option input[type="file"]').set('size', 15);
} else if(number == 3) {
$('battle-options').addClass('three-options');
new Elements([option3, versus3]).setStyle('display','block');
$$('.battle-option input[type="file"]').set('size', 19);
} else if(number == 2) {
$('battle-options').addClass('two-options');
$$('.battle-option input[type="file"]').set('size', 22);
}
}
};
window.addEvent('domready', function(){
Add.setOptions(2);
});
</script>
我有这个错误信息:
未捕获的 TypeError:[对象窗口] 没有方法“addEvent”?