Jump to content

Sleep


ajicles

Recommended Posts

I have a download page for my website and I tried using sleep to delay before the user can download an item. Right now I am using javascript to display a count down and the download link is in a hidden div and I wanted to have a time in php when the user goes to the page the timer starts and then echos the download link instead it being visible in the source code.

 

<script> 
<!-- 
// 
var milisec=0 
var seconds=30 
document.counter.d2.value="30" 

function display(){ 
if (milisec<=0){ 
    milisec=9 
    seconds-=1 
} 
if (seconds<=-1){ 
    milisec=0 
    seconds+=1 
} 
else 
    milisec-=1 
    document.counter.d2.value=seconds+"."+milisec 
    setTimeout("display()",100) 
} 
display() 
--> 
</script> 


<div id="hid" style="visibility:hidden"><center><a href="upload/'.$row[4].'/'.$row[1].'"><img src="images/download.png" width="200" height="55" border="0" /></a></center></div>
<script type="text/javascript">
function showIt() {
  document.getElementById("hid").style.visibility = "visible";
}
setTimeout("showIt()", 30000); // after 1 sec
</script>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.