Friday 23 January 2015

Toggle image_Javascript

Toggle image_Javascript :
--------------------------------
<!DOCTYPE html>
<html>
<head>
<script language="javascript" type="text/javascript">
var imageNo = 2;
function swapImage() {
image = document.getElementById('image')
switch (imageNo) {
case 1:
  image.src = "img/back.png"
  imageNo = 2
  document.getElementById('content').style.display = 'none'
  return(false);
case 2:
  image.src = "img/back2.png"
  imageNo = 1
document.getElementById('content').style.display = 'block'
return(false);
}
}
</script>
</head>
<body>

 <h4><a ><img id="image" name="image" src="img/back.png" border="0" onclick="swapImage();"/></a></h4>
<!-- Your normal document content lives here -->
</body>
</html>

No comments:

Post a Comment