| | |
HTML Tables in JSP
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2009
Posts: 93
Reputation:
Solved Threads: 1
Hi,
I'm trying to create a page that contains a table that is hidden initially (on page startup). Later, when a link is clicked, the table should show permanently. The problem I am having, however, is that when I click on the link, the table shows for a second and then dissapears again. Below is the code:
I know incrementing a variable may not be the most efficient way, but for now if I can get that to work then it will be easy to change that to boolean at a later stage...
I'm trying to create a page that contains a table that is hidden initially (on page startup). Later, when a link is clicked, the table should show permanently. The problem I am having, however, is that when I click on the link, the table shows for a second and then dissapears again. Below is the code:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<head> <script type="text/javascript"> var n=0; </script> </head> <body onload="tableOff('myTable')"> <!-- Extend/Collapse Tables Script --> <script type="text/javascript"> function tableOff(Object) { if (n==0) { document.getElementById(Object).style.display="none"; } n++; } function tableOn(Object) { if (n >=1) { document.getElementById(Object).style.display=""; } } </script> <!-- Extend/Collapse Tables Script --> <table id="myTable"> <tr> <td> My Table </td> </tr> </table> <a href="this.jsp" onClick="tableOn('myTable')">Click Me</a> </body>
I know incrementing a variable may not be the most efficient way, but for now if I can get that to work then it will be easy to change that to boolean at a later stage...
Hi Ashton,
in the <head> section of your page, you may apply this format:
do the same instance as you call your tableOn( tableID ) function...
in the <head> section of your page, you may apply this format:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script type="text/javascript"> <!-- // Basic Sample var tableOn = function( obj ) { document.getElementById( obj ).style.display = "table"; }; onload = function() { document.getElementById("myTable").style.display = "none"; }; // --> </script>
do the same instance as you call your tableOn( tableID ) function...
<a href="javascript:void(0);" onclick="tableOn('myTable');">Show Table</a> ![]() |
Similar Threads
- HTML Tables vs CSS & divs - examples/help (HTML and CSS)
- Create HTML file from Dynamic JSP (JSP)
- coverting html tables into xhtml and css (HTML and CSS)
- file handling in html and jsp (HTML and CSS)
- help needed in coloring html tables (JavaScript / DHTML / AJAX)
- Creatin table in JSP (JSP)
- updating 2 HTML tables on one PHP page (PHP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: need help changing background color of an iframe
- Next Thread: need javascript coding!
Views: 275 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
acid2 ajax ajaxexample ajaxjspservlets array autoplay beta blackjack boarder box browser captcha captchaformproblem cart close codes column css date debugger decimal dependent design developer dom download element embed enter error events firefox flash focus form frameworks game gears getselection google gwt gxt hiddenvalue highlightedword hint html ie7 iframe index java javascript javascripthelp2020 javascripts jquery jsp libcurl listbox maps marquee masterpage media menu mimic mp4 onerror onmouseover parameters paypal php player position post problem programming prototype rating redirect safari scale scriptlets search security select size software solutions sources starrating synchronous toggle tweet unicode variables w3c web webkit webservice window windowofwords xml





