0

http://jsfiddle.net/altafali/G2pLW/16/

我怎样才能修复它以在 ie 或 Opera 浏览器中工作?

我还想在这个 div 的可见性上添加一些延迟?像 30 秒的计时器询问 onclick 您的链接将在 30 秒内出现

在这里查看实际操作 http://www.symbianhome.com/ibibo-ibrowser-free-download-v2

谢谢

4

1 回答 1

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>
于 2012-08-20T04:53:17.097 回答