JavaScript Can Change HTML Attributes

<script type="text/javascript">
	function myFunction(){
		var x = document.getElementById('imgID');

		if(x.src.match('3')){
			x.src="4.jpg"	
		} 
			else
		{
			x.src="3.jpg"	
		}
	}
</script>
<img id="imgID" onclick="myFunction()" src="3.jpg" />

Author: Raghava

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *


*

'