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

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

不言
不言Original
2018-05-23 15:25:5311841browse

<!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>

回复讨论(解决方案)

click() 把名字换下就ok了

fa0e826502645a16d13f28605941a861 写错了。。。。2cacc6d41bbb37262a98f745aa00fbf0 否则是不执行的 

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

Statement:
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