我碰到一個代碼,據說只更新那段代碼,它放在div
標籤內。我需要打印剩下的秒數1-1-2013
。但我什麼都看不到。放在div
標記內的任何內容都不可見。由於我不在JQuery
和Ajax
,我無法發現我的錯誤。我把任何東西放在div標籤中,沒有打印
<body bgcolor="#73AF59">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js">
</script>
<audio preload="auto" src="tones/Time-In-A-Bottle.mp3" loop autoplay>
</audio>
<%!
GregorianCalendar newYear = new GregorianCalendar(2013, 0, 1);
/*
* 0 : January
* 1 : 1st January
* 2013 : year
*/
%>
<table width="100%">
<tr>
<td width="40%"> </td>
<td> <img src="images/animations/pyear.gif" /> </td>
</tr>
<tr>
<td width="40%"> <center> <font face="Chiller" size="+6"> <br /> Countdown </font> </center> </td>
<td> <center> <font face="Chiller" size="+6"> <br />
<script type="text/javascript">
var auto_refresh = setInterval(
function()
{
$('#load_tweets').load('record_count.php').fadeIn("slow");
}, 1000); // refresh every 10000 milliseconds
<div id="load_tweets">
<%= (newYear.getTimeInMillis() - new GregorianCalendar().getTimeInMillis())/1000 %>
</div>
</script>
</font> </center>
</td>
</tr>
<tr>
<td colspan="2" style="height:400px" valign="bottom"> <img src="images/animations/3D_balloons.gif" />
<em>This poor design and animations compiled by Suhail Gupta.</em>
<audio style="visibility: hidden" > </audio>
</td>
</tr>
<!-- !-->
聲明<%= (newYear.getTimeInMillis() - new GregorianCalendar().getTimeInMillis())/1000 %>
,應打印左爲2013年
我上傳了完整的代碼[HERE](http://suhail3.my3gb.com/nyblast%20%28copy%29.jsp) –
'font'標籤??它們在html5中被棄用。使用CSS – charlietfl
Scriptlet只執行一次,除非你刷新當前頁面,並且'$('#load_tweets')。load('record_count.php')。fadeIn(「slow」);'do ? – adatapost