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" />
Posted in JS

Leave a Reply

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


*