Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 280
  • Last Modified:

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

How to hide/suppress a html table is no data is presented?
0
kgittinger
Asked:
kgittinger
  • 2
  • 2
1 Solution
 
Brian PringleSystems Analyst II, SCM, ERPCommented:
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
 
Om PrakashCommented:
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
 
kgittingerAuthor Commented:
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
 
kgittingerAuthor Commented:
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
 
Brian PringleSystems Analyst II, SCM, ERPCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now