gpt4 book ai didi

javascript - 未捕获的类型错误 :[object window] has no method 'addEvent'

转载 作者:行者123 更新时间:2023-11-28 16:18:15 26 4
gpt4 key购买 nike

这个脚本在这里工作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>

我收到此错误消息:

Uncaught TypeError:[object window] has no method 'addEvent'?

最佳答案

window.addEvent 只能通过 MooTools 获得(正在 jsfiddle 页面上加载)。

https://mootools.net/docs/core/Element/Element.Event

来自文档:

Notes: This method is also attached to Document and Window.

关于javascript - 未捕获的类型错误 :[object window] has no method 'addEvent' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10705417/

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