Page 1 of 1

manipulating the table cell's data with js...

Posted: Thu Feb 06, 2003 4:33 pm
by lostboy
is it possible?

ex. want to insert a date into a table cell...easy with asp/php etc. but want to do this with js...how do i refer to that table cell to show the current date/time?

TIA

Posted: Thu Feb 06, 2003 9:10 pm
by Rob the R
It is. I found a web page that describes this. I tested it on my browser (Safari), and it worked great! That website claims this works in all sorts of browsers. I tested it with this:

Code: Select all

<table>
   <tr>
      <td><span id="cell">One</span></td>
   </tr>
</table>

<a href="javascript:document.getElementById('cell').innerHTML='One';">One</a>
<br>
<a href="javascript:document.getElementById('cell').innerHTML='Two';">Two</a>
<br>
<a href="javascript:document.getElementById('cell').innerHTML='Three';">Three</a>
I should think you could use the "innerHTML" technique from any Javascript code, and not just the test links I used above.

Posted: Fri Feb 07, 2003 5:58 am
by Johnm
lostboy,
Check out this thread. The first example worked for me.




John M


viewtopic.php?t=1192