2012-08-16 49 views
0

http://jsfiddle.net/altafali/G2pLW/16/不工作在ie,歌劇如何修復?

我該如何修復它以在ie或opera瀏覽器中工作?

另外我想在這個div的可見性上添加一些延遲?像30秒,詢問的onclick你的鏈接將在30秒

apear定時器看到這裏的行動 http://www.symbianhome.com/ibibo-ibrowser-free-download-v2

感謝

+0

在Opera中可以正常工作。你能更詳細地描述你所看到的問題嗎? – hallvors 2012-08-17 11:41:30

+0

在刪除緩存後在opera中工作,但是如何在點擊下載按鈕後添加定時器,就像在附加div在30秒內出現後點擊按鈕一樣? – 2012-08-18 17:52:18

回答

0

代碼工作在Opera。對於延遲演出,使用此。它也會在點擊後禁用按鈕。

<script> 
var remaining=30; 
function countDown() { 
    remaining--; //decrease remaining 
    document.getElementById('counter').innerText = remaining; //update display 
    if (remaining > 0) { //more remains? 
    window.setTimeout(countDown, 1000); //yes. wait again 
    } else { //no. show the content 
    document.getElementById('divId').style.visibility = 'visible'; 
    } 
} 
function delayShow(ele) { 
    ele.disabled = true; 
    document.getElementById('counter').innerText = remaining; //show it 
    window.setTimeout(countDown, 1000); //wait for 1 second then call countDown 
} 
</script> 

<div id="divId" style="visibility:hidden">Content!</div> 

<button onclick="delayShow(this)">DOWNLOAD</button> <span id="counter"></span> 
+0

偉大的作品....但如何顯示運行計時器30秒? – 2012-08-20 18:02:58

+0

更新了代碼。應該足以讓你開始。 – Jay 2012-08-20 20:57:15

+0

我應該在哪裏放置span標籤? – 2012-08-21 08:33:05