Hello, I am using this script to display and hide divs in my pages. You use a dropdown menu to select the div, which will then hide the other div(s). The issue I am having is that on loading the page both div's appear. How can I make it so that only one div shows by default. Here's the code I am using. Here's a link to see it in action: http://www.plrfreedom.com/test.html <script type="text/javascript"> function el(tid) { //gets an element by its ID. return document.getElementById(tid); } //a show-hide toggle function function showme(s) { var elmt = el(s); var els = elmt.style; if (els.display && els.display != "none") { elmt._sty_disp_bk = els.display ? els.display : "none"; elmt.style.display = "none"; } else { elmt.style.display = elmt._sty_disp_bk || "block"; return 1; } } function hide(s) { el(s).style.display = "none"; } function show(s) { el(s).style.display = "block"; } </script> </head> <select onchange="i=this.options[this.selectedIndex].text; if(i=='Version 1'){ show('block'); hide('block2'); };if(i=='Version 2'){ hide('block'); show('block2')}" style="width: 100px; font-size: xx-small;" name="coordinates"> <option value="">Select Version... <option id="searchblock" value="">Version 1 <option id="searchblock2" value="">Version 2 </select> <div id="block"> Another Tester </div> <div id="block2"> Just Testing </div>
This should be bery simple for someone with some html or php experience.. Can someone solve this please. Thanks