인터넷정보

이미지 슬라이드

알 수 없는 사용자 2007. 10. 18. 13:44
<script language="JavaScript">
picture1 = new Image()
picture1.src = "img1.jpg"

picture11 = new Image()
picture11.src = "img2.jpg"

picture111 = new Image()
picture111.src = "img3.jpg"

picture1111 = new Image()
picture1111.src = "img4.jpg"

picture11111 = new Image()
picture11111.src = "img5.jpg"

function switchImage(imageName) {
  mousePosition = document.Iform.Ihide.value
  if (mousePosition == "11111") {
    var mousePosition = 0
  }
  
  mousePosition = mousePosition + 1
  imgToAlter = eval(imageName + mousePosition + ".src");
   document.images[imageName].src = imgToAlter;
  document.Iform.Ihide.value = mousePosition
  
}
</script>

<form name="Iform" method="get">
<input type=hidden name="Ihide">
<img src="img6.jpg" width="178" height="270" border="0" name="picture">
<input type="button" value="Change Image" onclick="switchImage('picture')">
</form>
반응형