Home > Web Front-end > HTML Tutorial > 点击一张图片切换到另一张图片_html/css_WEB-ITnose

点击一张图片切换到另一张图片_html/css_WEB-ITnose

不言
Release: 2018-05-23 15:25:53
Original
11911 people have browsed it

<!DOCTYPE html> 
<html> 
<body> 

<img id="image" src="/i/eg_tulip.jpg" onclick="click()"/> 

<script> 
function click(){ 

document.getElementById("image").src="/i/shanghai_lupu_bridge.jpg"; 
} 
</scrip> 


</body> 
</html>
Copy after login

回复讨论(解决方案)

click() 把名字换下就ok了

写错了。。。。 否则是不执行的 

其实 onclick = "this.src='/i/shanghai_lupu_bridge.jpg'";

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template