我有一个<td>
设置为 display的表div#time2
,其中填充了来自数据库 [LastBuild] 的时间。下面是一个包含 的段落div#time
,其中填充了当前时间。我的问题是#time2
和 [LastBuild] 不在同一条线上;[LastBuild] 如下图所示#time2
。我需要这两个在同一行(段落之后的第二部分已经做了我想要的)。
<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>
这是馈送div
s 的 JavaScript:
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];