Solved

How to hide/suppress a html table is no data is presented?

Posted on 2013-06-10
5
274 Views
Last Modified: 2013-06-10
How to hide/suppress a html table is no data is presented?
0
Comment
Question by:kgittinger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:Brian Pringle
ID: 39234572
Is this data dynamically generated or is it manually entered?  If it is dynamic, then you could include an IF statement to comment out the table so that it does not appear.
0
 
LVL 22

Expert Comment

by:Om Prakash
ID: 39234574
The best method is to use a server side language to generate the required table based on the data from database

To hide/show a table you can use the following:
document.getElementById("table_id").display = "";  //Show the table   
document.getElementById("table_id").display = "none";  //Hide the table 

Open in new window

0
 

Author Comment

by:kgittinger
ID: 39234587
The data is dynamically generated.  My if statement returns no data when appropriate, but I cannot seem to hide/suppress the table header/boarders...

I am new to this.  Thank you very much.
0
 

Author Comment

by:kgittinger
ID: 39234635
One more thing.  Each table is formed via a dynamic query.  The tables are not named.   Do the tables need to be named for the above to work?
0
 
LVL 16

Accepted Solution

by:
Brian Pringle earned 500 total points
ID: 39234677
You can have the table itself created by ASP, PHP, whatever language you are using on the server.  Then, the creation of the table would be dependent on your IF statement.  

Something like this... (not exact)

IF there is data to put in the table
   document.writeline("<table>")
   document.writeline("<tr>")
   document.writeline("<td>" + %firstitem% + "</td>")
.
And so on...
.
.
ENDIF
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question