Tuesday, 8 November 2011

image change smaller and bigger when you click on the image

<html>
<head>
<title>::: Please Give me a title</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
img.small{width:300px;}
img.large{width:100%;}
</style>
<script type="text/javascript">
window.onload = function()
{
 var obj=document.getElementById('wrap').getElementsByTagName('img');
 for(var start=0;start<obj.length;start++)
  {obj[start].onclick=function() 
   {this.className = (this.className != 'small')? 'small': 'large';}
  }
}
</script>
</head>
<body>
<div id="wrap">
<img src="http://www.digitalphotoguides.com/tuts/background-removal.jpg" class="large"/>
</div>
</body>
</html>

No comments:

Post a Comment