/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<a href="javascript:viewMore('two');" id="xtwo">... more</a> <p>I see one.</p> <p id="two" style="display:none">I see two.</p> function viewMore(div) { obj = document.getElementById(div); col = document.getElementById("x" + div); if (obj.style.display == "none") { obj.style.display = "block"; col.innerHTML = "... less"; } else { obj.style.display = "none"; col.innerHTML = "... more"; } }