• Page 1 of 1
  • 1
How to make guests to wait 30 secs before they can download
Unique
Posts: 421
Reputation: 35

Message # 1 | 4:35 PM
1. Paste this code in the top part of your website:
Code
<script type="text/javascript">  
<!--  
var count=30;  
var obj;  
window.onload=function() {  
obj=document.getElementById('delayed');  
obj.onclick=function() {  
if(count<=0) {  
return true;  
}  
else {  
if(count==30) {  
waitForIt();  
return false;  
}  
else {  
return false;  
}  
}  
}  
}  
function waitForIt() {  
obj.firstChild.data='Link will be available after '+count+'secs';  
if(count<=0) {  
clearTimeout(cd);  
obj.firstChild.data='Click here to Download';  
obj.className='go';  
return;  
}  
count--;  
cd=setTimeout('waitForIt()',1000);  
}  
//-->  
</script>

2. Add this code where you want your download link to appear:

Code
<div>  
<a id="delayed" class="stop" href="http://www.uCoz.com/">Download (30sec)</a>  
</div>

C/P


NTP
Posts: 296
Reputation: 10

Message # 2 | 11:02 PM
It keeps popping up the download, without any count.
Web design and film == my 2 passions.

Genesis Inc. ~ New Horizons, New Beginnings
Unique
Posts: 421
Reputation: 35

Message # 3 | 2:17 PM
NTP, it's works fine for me, you need to make it visible only for guest with conditional operations:
Code
<?if(!$USER_LOGGED_IN$)?>Download link for users<?else?> Code for GUEST <?endif?>

or

Code
<?if($USER_ID$=0)?>Code for GUEST<?else?> Download link for users <?endif?>

Post edited by Unique - Friday, 2010-10-08, 1:17 PM
Zain
Posts: 68
Reputation: -7

Message # 4 | 7:49 AM
yes it's work perfect with first code
  • Page 1 of 1
  • 1
Search: