日期:2014-05-16 浏览次数:20391 次
<body>imgsrc0 = imgsrc1;为什么不好使?
<div id="tupian01">
<img src="01.jpg" width="180px" height="260px" />
<img src="02.jpg" width="180px" height="260px" />
<img src="03.jpg" width="180px" height="260px" />
<img src="04.jpg" width="180px" height="260px" />
<img src="05.jpg" width="180px" height="260px" />
</div>
<script type="text/javascript">
var imgsrc0 = document.getElementsByTagName("img")[0].src;
var imgsrc1 = document.getElementsByTagName("img")[1].src;
function huantu(){
imgsrc0 = imgsrc1;
}
</script>
<div id="anjian01">
<input type="button" id="an01" value="01" />
<input type="button" id="an02" value="02" onclick="huantu()" />
</div>
</body>
function huantu(){
imgsrc0 = imgsrc1;
}
function huantu(){
document.getElementsByTagName("img")[0].src = imgsrc1;
}