-2
我有代碼應該顯示廣告10秒,然後加載嵌入代碼。 它在Firefox上運行良好,但在IE9上它在後臺運行廣告和嵌入代碼。Javascript代碼在IE9上運行不正常
<script type="text/javascript">
var nbsec = 10;
var c = 0;
var t;
var timer_is_on = 0;
var sum = 0;
function timedCount()
{
c = c + 1;
t = setTimeout("timedCount()", 1000);
sum = nbsec - c;
document.getElementById('chrono').innerHTML = "<br>Loading .. Please wait " + sum + "secondes";
if(c == nbsec) {
stopCount();
document.getElementById('mypub').style.visibility = 'hidden';
document.getElementById('mygame').style.visibility = 'visible';
document.getElementById('mygame').style.display = 'block';
document.getElementById('mygame').style.height = 'auto';
document.getElementById('mypub').style.height = '0px';
document.getElementById('mypub').style.padding = '0px';
document.getElementById('mypub').innerHTML = "";
}
}
function stopCount()
{
clearTimeout(t);
timer_is_on = 0;
}
</script>
<table border="2" align="center" color="F2FC7E">
<tr>
<td>
<div id="mypub" style="visibility: visible; text-align:center; padding:20px;">
<script>
..............
</script>
<div id="chrono" style="color:#FFF;"></div>
</div>
<div id="mygame" style="visibility: hidden;display:none; height:0px">
<param name="initial_focus" value="true">
<applet>
........................
</applet>
</div>
</td>
</tr>
</table>
<script type="text/javascript">
timedCount();
</script>
有沒有辦法解決這個問題?
that's請從您的代碼中刪除所有的反引號和四個空格縮進代碼整個街區。 http://stackoverflow.com/editing-help#code –
僅供參考:您使用屬性來設置表格的樣式已過時,您應該使用css類來更改樣式,而不是一個接一個地進行樣式設置。同樣的做法是將相同的'document.getElementById('mypub')'粘貼一遍又一遍,使用一個變量。 – epascarello
t = setTimeout(「timedCount()」,1000);我不認爲它應該有引用功能名稱 –