JavaScript Zastąp treść div OnClick A Button

<div id = "div1" style="display:block"><img src="1.jpg" /></div>

<div id = "div2" style="display:none"><img src="2.jpg" /></div>

<button type="submit" onclick = "replace()">change content</button>


<script type = "text/javascript">
function replace() {
document.getElementById("div1").style.display="none";
document.getElementById("div2").style.display="block";
}

</script>
Blue-eyed Booby