Solved

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

Posted on 2013-06-10
5
270 Views
Last Modified: 2013-06-10
How to hide/suppress a html table is no data is presented?
0
Comment
Question by:kgittinger
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:Brian Pringle
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now