...

View Full Version : Replace one div with another



mattsearle
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.

[code]
<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>

[ICODE]

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum