jandrews3 Posted October 11, 2010 Share Posted October 11, 2010 I got the following code to work on a page to hide or toggle showing a particular table by clicking a button. BUT, I want the initial setting to be to HIDE the table. Only by clicking the button do I want it to show the table. The script works great except that on load, the table shows. You have to click the button to hide it. I want it to hide the table by default without clicking. I'm sure this is an easy solution, but I know next to nothing about javascript. THANKS!!! <script type="text/javascript"> function displayRow(){ var row = document.getElementById("captionRow"); if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; } </script> <input type="button" onclick="displayRow()" style="margin-left: 10px;">Add links to this paragraph: <table width="600" border="0" style="font-size: 9pt; margin-left: 10px;"> <tr id="captionRow"> <td> Page text:<input type="text" name="embedT<?print $lcount?>" /><br /> Page text:<input type="text" name="embedT<?print $lcount?>" /><br /> Page text:<input type="text" name="embedT<?print $lcount?>" /><br /> </td> <td> Link address:<input type="text" name="embedT<?print $lcount?>" value="http://www."/><br /> Link address:<input type="text" name="embedT<?print $lcount?>" value="http://www."/><br /> Link address:<input type="text" name="embedT<?print $lcount?>" value="http://www."/><br /> </td> </tr> </table> Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 11, 2010 Share Posted October 11, 2010 Change this - <tr id="captionRow"> to this - <tr id="captionRow" style="display:none"> Quote Link to comment Share on other sites More sharing options...
jandrews3 Posted October 11, 2010 Author Share Posted October 11, 2010 Dude! Awesome! I knew it would be easy, just not THAT easy. I just don't know anything. That worked like a gem! THANKS!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.