求助!这段代码如何适应多浏览器呀!
各位:这是个奥运到记时的,我如何让他支持多浏览器呀,谢谢!尤其是firefox。
下面是代码:
————————————————————————————————
<HTML>
<HEAD>
<SCRIPT language=javascript>
<!--
function jisuanshijian(){
window.setTimeout( "jisuanshijian() ", 1000);
aoyunshijian=new Date( "8-8-2008 ");
today=new Date();
//aoyunshijian.setHours(20,00,00,00);
timejuli=(aoyunshijian.getTime()-today.getTime()); //得到结果为毫秒
allseconds=timejuli/1000 + 20*60*60
second_int=Math.floor(allseconds);
day_second=24*60*60 //一天=这些秒
day_float=allseconds/day_second
days_int=Math.floor(day_float);
hours_float=(day_float-days_int)*24;
hours_int=Math.floor(hours_float);
minus_int_float=(hours_float-hours_int)*60;
minus_int=Math.floor((hours_float-hours_int)*60);
seconds=Math.floor((minus_int_float-minus_int)*60);
//document.write( " "+days_int+ "天 "+hours_int+ "小时 "+minus_int+ "分 "+seconds+ "秒 "+ " " );
liveclock.innerHTML= " <font color= '#f9f750 '> <strong> "+days_int+ " </strong> 天 <strong> "+hours_int+ " </strong> 小时
<strong> "+minus_int+ " </strong> 分 <strong> "+seconds+ " </strong> 秒 </font> "+ " " ;
}
//-->
</SCRIPT>
<style type= "text/css ">
<!--
.STYLE2 {
font-family: "宋体 ";
font-size: medium;
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
</HEAD>
<BODY onLoad= "jisuanshijian() ">
<table width= "200 " height= "60 " border= "0 " >
<tr bgcolor= "#b54201 ">
<td colspan= "4 " align= "center ">
<span class= "STYLE2 "> 距离奥运会开幕还有 </span> <br>
<span id=liveclock > </span> </td>
</tr>
</table>
</BODY>
</HTML>
------解决方案--------------------window.setTimeout(jisuanshijian, 1000); /此句不换没关系。。看那个不爽才改了:D
aoyunshijian=new Date(2008, 7, 8);//new Date( "8-8-2008 ");
替换即可
------解决方案--------------------to ls
^o^
那是你粘贴的时候把代码COPY错了。。。
<strong> "+hours_int+ " </strong> 小时
<strong> "+minus_int+ " </strong> 分 <strong> "+seconds+ " </strong> 秒 </font> "+ " " ;
把这里这个换行去掉就可以测试通过了。。