iceman023 Posted May 5, 2009 Share Posted May 5, 2009 I have a comments page and i need to add replys.. How do i make a form containing a textbox and sumbit button appear by clicking on another button that saids "click here to reply" and the form appears, not as a popup though. Thanks.. Link to comment https://forums.phpfreaks.com/topic/156901-solved-how-do-i-make-a-table-visable-and-not-visable-by-a-button/ Share on other sites More sharing options...
whizzopia Posted May 5, 2009 Share Posted May 5, 2009 You need to use javascript, not php code. Link to comment https://forums.phpfreaks.com/topic/156901-solved-how-do-i-make-a-table-visable-and-not-visable-by-a-button/#findComment-826542 Share on other sites More sharing options...
the182guy Posted May 5, 2009 Share Posted May 5, 2009 The code below will show/hide the contents of a div when clicking the button. Put your form inside the div. <input type="button" value="Show Comment" onclick="toggleComment()" id="toggle_button"> <div id="comment_area" style="display:none;"> put your form with textboxes in here </div> <script type="text/javascript"> function toggleComment() { var commentArea = document.getElementById("comment_area"); var toggleButton = document.getElementById("toggle_button"); if(label == "Show Comment") { commentArea.style.display = ""; //show it toggleButton.value = "Hide Comment"; } else { commentArea.style.display = "none"; //hide it toggleButton.value = "Show Comment"; } } </script> Link to comment https://forums.phpfreaks.com/topic/156901-solved-how-do-i-make-a-table-visable-and-not-visable-by-a-button/#findComment-826550 Share on other sites More sharing options...
iceman023 Posted May 5, 2009 Author Share Posted May 5, 2009 Thanks, but i have this and nothing happens.. did i do something wrong? <html> <head> <title></title> <script type="text/javascript"> function toggleComment() { var commentArea = document.getElementById("comment_area"); var toggleButton = document.getElementById("toggle_button"); if(label == "Show Comment") { commentArea.style.display = ""; //show it toggleButton.value = "Hide Comment"; } else { commentArea.style.display = "none"; //hide it toggleButton.value = "Show Comment"; } } </script> </head> <body> <input type="button" value="Show Comment" onclick="toggleComment()" id="toggle_button"> <div id="comment_area" style="display:none;"> <form name="form1" method="post" action=""> <center> <label for="Show Comment"></label> <p> <textarea name="reply" cols="40" rows="5" id="reply"></textarea> </p> <p>Replied By: </p> <p> <label for="textfield"></label> <input name="AuthorReply" type="text" id="AuthorReply" size="40"> <label for="Submit"></label> <input type="submit" name="Submit" value="Submit" id="Submit"> </p></center> </form> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/156901-solved-how-do-i-make-a-table-visable-and-not-visable-by-a-button/#findComment-826763 Share on other sites More sharing options...
Ken2k7 Posted May 5, 2009 Share Posted May 5, 2009 No, not you. the182guy make an booboo. <html> <head> <title></title> <script type="text/javascript"> function toggleComment() { var commentArea = document.getElementById("comment_area"); commentArea.style.display = commentArea.style.diplay == ""? "none" : ""; } </script> </head> <body> <input type="button" value="Show Comment" onclick="toggleComment()" id="toggle_button"> <div id="comment_area" style="display:none;"> <form name="form1" method="post" action=""> <center> <label for="Show Comment"></label> <p> <textarea name="reply" cols="40" rows="5" id="reply"></textarea> </p> <p>Replied By: </p> <p> <label for="textfield"></label> <input name="AuthorReply" type="text" id="AuthorReply" size="40"> <label for="Submit"></label> <input type="submit" name="Submit" value="Submit" id="Submit"> </p></center> </form> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/156901-solved-how-do-i-make-a-table-visable-and-not-visable-by-a-button/#findComment-826831 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.