View Full Version : Replace one div with another

11-07-2012, 12:25 PM
Hi I have discovered the script below which I would like to work with buttons as opposed to hovering and clicking on the text.

<div id = "div1" style="display:block" onclick = "replace()">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ipsum leo, scelerisque at dapibus ac, consectetur vel ipsum. </div>
<div id = "div2" style="display:none">Cras suscipit ullamcorper elit vitae sodales. Sed euismod felis molestie lorem gravida a venenatis risus sollicitudin. Proin accumsan lorem in est adipiscing faucibus. </div> <script type = "text/javascript"> function replace() { document.getElementById("div1").style.display="none"; document.getElementById("div2").style.display="block"; } </script>


Read more at http://www.codingforums.com/showthread.php?t=201738#DU65QvTEsECL65w6.99

11-07-2012, 03:46 PM
Read this http://www.w3schools.com/js/js_functions.asp