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> Link to comment https://forums.phpfreaks.com/topic/215583-default-set-to-no-show/ 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"> Link to comment https://forums.phpfreaks.com/topic/215583-default-set-to-no-show/#findComment-1120943 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!!! Link to comment https://forums.phpfreaks.com/topic/215583-default-set-to-no-show/#findComment-1120947 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.