点击按钮 变换图片

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>变换图片</title>
<script type="text/javascript">
function changeImage(){
var img = window.document.getElementById("img").src;
if(img == "taohua.jpg"){
window.document.getElementById("img").src = "yinghua.jpg";
}else{
window.document.getElementById("img").src = "taohua.jpg";
}
}
</script>
</head>

<body>
<p>&nbsp;</p>
<p> <img src="yinghua.jpg" width="500" height="300" id="img" /> </p>
<p>
<input type="button" value="我要看桃花" onclick="changeImage();" />
</p>
</body>
</html>

posted on 2014-08-12 15:33  moliwanzi  阅读(363)  评论(0编辑  收藏  举报

导航