I have a table with a <td>
set up to display div#time2
, which is filled with a time from a database [LastBuild]. Below that is a paragraph containing div#time
, which is filled with the current time. My problem is that #time2
and [LastBuild] do not align on the same line; [LastBuild] is shown below #time2
. I need those two on the same line (the second part after the paragraph already does what I want).
<table style="border-style:none; width:850px; border-spacing:0; border-collapse:collapse;">
<tr>
<td style="float:left; background-color:#000000;color:#FFFF00; width:335px; text-align:left; font-size:10;">By TrueLogic Company
<p>Edited By International Electronic Components</p>
</td>
<td width="200"></td>
<td style="float:right;background-color:#000000;color:#FFFF00; width:235px; text-align:right; font-size:10;">
<div id="time2"></div>
[LastBuild]
<p>
<div id="time" align="right" style="background-color:#000000;color:#FFFF00;"></div>
</p>
</td>
</tr>
</table>
Here is the JavaScript feeding the div
s:
var mydate=new Date();
var year=mydate.getYear();
if (year < 1000) year+=1900;
var day=mydate.getDay();
var month=mydate.getMonth();
var daym=mydate.getDate();
if (daym<10) daym="0"+daym;
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var montharray=new Array("1","2","3","4","5","6","7","8","9","10","11","12");
var date=new Date();
var hours=date.getHours();
var minutes=date.getMinutes();
var ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12;
minutes = minutes < 10 ? '0'+minutes : minutes;
var s=date.getSeconds();
s = s < 10 ? '0'+s : s;
var Time = "Current Time: ";
var Text = "Last Update: ";
document.getElementById('time').innerHTML =Time+" "+dayarray[day]+" "+montharray[month]+"/"+daym+"/"+year+" "+hours+":"+minutes+":"+s+" "+ampm;
document.getElementById('time2').innerHTML =Text+" "+dayarray[day];