未捕获Javascript错误
我有一个未捕获的JavaScript错误,我不知道如何修复它未捕获Javascript错误,javascript,html,Javascript,Html,我有一个未捕获的JavaScript错误,我不知道如何修复它 Uncaught TypeError: undefined is not a function games.html:37 event.returnValue is deprecated. Please use the standard event.preventDefault() instead. HTML <a href="#" onclick="slide_1()"> <img id="slide_1"
Uncaught TypeError: undefined is not a function games.html:37
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
HTML
<a href="#" onclick="slide_1()">
<img id="slide_1" class="slide_preview" height="50" src="images/slide_1.jpg" />
</a>
幻灯片函数增加到5个,您可以通过
getElementById(“…”)
我的猜测问题是由于这一行造成的
document.getElementById("slide").style.backgroundImage=slide_1;
。。。因为您正在将backgroundImage
属性设置为函数的引用
您的文档中似乎还有一个名为幻灯片1的元素。。。这可能就是你试图将背景图像设置为。。。但我不太明白你到底想达到什么目的
document.getElementById("slide").style.backgroundImage=slide_1
您正在尝试将函数设置为背景图像。(幻灯片1是一个函数,而不是图像url)给出一个复制问题的代码示例,它是一个字符串变量,该字符串中有链接
document.getElementById("slide").style.backgroundImage=slide_1