Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6168585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:42:46+00:00 2026-05-23T22:42:46+00:00

I am trying to make a td disappear whenever the date occured before that

  • 0

I am trying to make a “td” disappear whenever the date occured before that date today (in the past). But what is happening is that only the first column is affected while the others aren’t.

 <script type="text/javascript">
    //<![CDATA[

    function vanish() {
    downloadUrl("bckendcommmap.php", function(data) {
    var xml = data.responseXML;
    var markers50 = xml.documentElement.getElementsByTagName("marker50");

    // Split timestamp into [ Y, M, D, h, m, s ]
    for (var i = 0; i < markers50.length; i++) {
    var newdate = markers50[0].getAttribute("date");
    var trainid = markers50[0].getAttribute("trainingid");
    var t = newdate.split(/[- :]/);

    // Apply each element to the Date function
    var d = new Date(t[0], t[1]-1, t[2]);

    alert(d);
    var rightNow = new Date();
    var trainingDate = new Date(d);

    if (rightNow < d ) {
    document.getElementById("assess").innerHTML = ""; /* make it disappear */
    }
    else if (rightNow > d ) {
    document.getElementById("edit").innerHTML = "";
    }

    // -> Wed Jun 09 2010 13:12:01 GMT+0100 (GMT Daylight Time)


    }
    });
    }

        function downloadUrl(url, callback) {
          var request = window.ActiveXObject ?
              new ActiveXObject('Microsoft.XMLHTTP') :
              new XMLHttpRequest;

          request.onreadystatechange = function() {
            if (request.readyState == 4) {
              request.onreadystatechange = doNothing;
              callback(request, request.status);
            }
          };

          request.open('GET', url, true);
          request.send(null);
        }
        function doNothing() {}
        //]]>
    </script>

Here are parts of the table and the td:

<body onload="vanish();">
<table id="gradient-style" width="290" border="0" cellspacing="0" cellpadding="0" >

<thead>
<tr>

<td align="center"><strong> Training Name</strong></td>
<td align="center"><strong> Description</strong></td>
<td align="center"><strong> Location</strong></td>
<td align="center"><strong> Date</strong></td>
<td align="center"><strong> Time Start</strong></td>
<td align="center"><strong> Time End</strong></td>
<td align="center"><strong> Capacity</strong></td>
<td align="center" colspan="2"><strong>Actions</strong></td>
</tr>
</thead>
<?php
while($rows=mysql_fetch_array($get)){
?>
<tbody>
<tr>

<td><?php echo $rows['title']; ?></td>
<td><?php echo $rows['description']; ?></td>
<td><?php echo $rows['location']; ?></td>
<td><?php echo $rows['date']; ?></td>
<td><?php echo $rows['start']; ?></td>
<td><?php echo $rows['end']; ?></td>
<td><?php echo $rows['capacity']; ?></td>

**<td align="center"><div id="edit"><a href="TrainingUpdate.php?id=<?php echo $rows['trainingid']; ?>">Edit</a></div></td><td align="center"><div id="assess"><a  href="Training_Assessment.php?id=<?php echo $rows['trainingid']; ?>">Assess Training</a></div></td>**

</tr>
</tbody>
<?php
}
?>
</table>
</body>

This line is the td that I’m trying to vanish with respect to the date:

<td align="center"><div id="edit"><a href="TrainingUpdate.php?id=<?php echo $rows['trainingid']; ?>">Edit</a></div></td><td align="center"><div id="assess"><a  href="Training_Assessment.php?id=<?php echo $rows['trainingid']; ?>">Assess Training</a></div></td>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:42:47+00:00Added an answer on May 23, 2026 at 10:42 pm

    You are only hiding the div, if you want to hide td Try this:

    **<td id="edit" align="center"><div><a href="TrainingUpdate.php?id=<?php echo $rows['trainingid']; ?>">Edit</a></div></td><td id="assess" align="center"><div><a  href="Training_Assessment.php?id=<?php echo $rows['trainingid']; ?>">Assess Training</a></div></td>**
    

    And the html code is inside a while loop so you will have multiple div's with same id! You need to give them unique ids:

    $i = 0;
    while($rows=mysql_fetch_array($get)){  
    /*  Code... */
    <?php
    $i = $i + 1;
    }
    ?>
    

    And
    <div id="assess<?php echo $i ?>>

    And in your javascript:

    /*  Code... */
    if (rightNow < d ) {  
    var i = 0;  
    while(document.getElementById("assess" + i) != null) {
    document.getElementById("assess").innerHTML = ""; /* make it disappear */  
    i++;
    }
    /* Code.../
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a button that changes two things with CSS. First, it
I'm trying to make work a functionality that exists on my website but works
Trying to make a make generic select control that I can dynamically add elements
Trying to make a custom :confirm message for a rails form that returns data
Trying to make simple minesweeper game in python, but have one problem. I have
i'm trying to make toggling div with only 1 javascript. I tried this, the
I am trying to figured out how to make a menu disappear when the
I'm trying to make a timer that measures the execution time of a scope.
Hello this might be really silly question but I am trying to make markers
I am trying to make a TableLayout for the Android but I cannot get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.