Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未捕获Javascript错误_Javascript_Html - Fatal编程技术网

未捕获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"

我有一个未捕获的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" 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