Dynamic cell value

windows

Guest
Ok, this is probably an easy thing to do however I could not succeed. Any help is appreciated.<br />
<br />
What I want is to set the values of table cells by means of javascript functions. I don't want to create the table on the client side, it will be static. However the contents of some cells will be calculated and set by javascript functions. <br />
<br />
Let's say I have a table something like below showing the current time in different cities of the world. Time in those cities will be calculated by a function called calculate_time().<br />
How can I do this? I think I could define form fields and assign function return value to their values but they would look ugly.<br />
<br />
Thanks.<br />
<br />
<table><br />
<tr><br />
<td>Current time in London : </td><br />
<td>calculate_time('London')???</td><br />
</tr><br />
<tr><br />
<td>Current time in Berlin : </td><br />
<td>calculate_time('Berlin')???</td><br />
</tr><br />
<table><!--content-->This may be of some help:<br />
<br />
<html><br />
<head><br />
<script language='javascript' type='text/javascript'><br />
function time()<br />
{<br />
now = new Date();<br />
document.getElementById('time').innerHTML = now;<br />
}<br />
</script><br />
</head><br />
<body onload='time()'><br />
<form><br />
<input type='button' value='Update time' onclick='time()'><br />
</form><br />
<div id='time' style='border: 1px #000000 solid;background-color: #ccc; width:250;height: 24'><br />
</div><br />
</body><br />
</html><br />
<br />
Bob<!--content-->
 
Back
Top