Javascript 未捕获类型错误:对象#<;HTMLImageElement>;没有方法';过滤器';

Javascript 未捕获类型错误:对象#<;HTMLImageElement>;没有方法';过滤器';,javascript,filter,blend,Javascript,Filter,Blend,这是我的老师的演示,他制作了一个横幅(像幻灯片一样),其中有3张图片会反复更改。 当我将此代码应用于我的项目时,出现了一个错误:uncaughttypeerror:Object#没有方法“filters” 我问他,他说“过滤器”方法用于IE浏览器,如果我想在chrome或firefox中使用它,我必须找到另一种方法 我搜索了谷歌,但仍然没有找到答案。请有人告诉我如何修复这个错误。非常感谢你 JS代码: var switchImage = 0; var imageArray = ['image1'

这是我的老师的演示,他制作了一个横幅(像幻灯片一样),其中有3张图片会反复更改。 当我将此代码应用于我的项目时,出现了一个错误:uncaughttypeerror:Object#没有方法“filters”

我问他,他说“过滤器”方法用于IE浏览器,如果我想在chrome或firefox中使用它,我必须找到另一种方法

我搜索了谷歌,但仍然没有找到答案。请有人告诉我如何修复这个错误。非常感谢你

JS代码:

var switchImage = 0;
var imageArray = ['image1','image2','image3'];
function blend() {
    for (var i =0; i <imageArray.length; i++) {
        if (i != switchImage) {
            document.getElementById(imageArray[i]).style.visibility = "hidden";
            document.getElementById(imageArray[i]).filters("blendTrans").apply();
            document.getElementById(imageArray[i]).filters("blendTrans").play();
        }
    }
}
function reBlend() {
    switchImage = Math.floor(Math.random() * (2 - 0 + 1)) + 0;
    document.getElementById(imageArray[switchImage]).style.visibility = "visible" ;
    for (var i = 0; i < imageArray.length; i++) {
        if (i != switchImage) {
            document.getElementById(imageArray[switchImage]).style.zIndex -= 4;
        } else {
            document.getElementById(imageArray[switchImage]).style.zIndex += 4;
        }
    }
    blend();
}
var-switchImage=0;
var imageArray=['image1','image2','image3'];
函数blend(){

对于(var i=0;我是你的导师。继续搜索!sr但我不是伊朗人…我在开玩笑。祝你好运!
。过滤器
不是一种方法,它应该与
[]
类似
元素一起使用。过滤器[“alpha”]
<IMG ID ="image1" SRC ="images/banner1.png" ONFILTERCHANGE ="reBlend()"
             style="position:absolute; 
                         filter:blendTrans(duration=3); z-index: 3"/>
<IMG ID ="image2" SRC ="images/banner2.jpg" ONFILTERCHANGE ="reBlend()"
             style="position:absolute; 
                         filter:blendTrans(duration=3); z-index: 2"/>
<IMG ID ="image3" SRC ="images/banner3.jpg" ONFILTERCHANGE ="reBlend()"
             style="position:absolute;
                         filter:blendTrans(duration=3); z-index: 1"/>