i want something like timer that we see in rapidshare free usage that makes user to wait for sometime before the download link appears please give me some code eg
With javascript, just have a div containing the time left before the download link becomes available. Then, every second minus one from an integer, and put it into the innerHTML of the div. Also, check if the integer is 0, and if it is, then change the innerHTML to the link. Have I understood you correctly? Need help coding that?
Here you go. Enjoy. I added some CSS to make it look pretty. <div id="container" style="width:125;height:23;background:#DDDDDD;text-align:center;padding:3px;"> <form name="form"><input type="text" size="8" name="time"></form></div> <script><!-- // var countdownfrom = 10; secondsleft = countdownfrom+1; document.form.time.value = countdownfrom; function countdown(){ if (secondsleft > 0){ secondsleft -= 1; } else { document.getElementById('container').innerHTML = '<a href="downloadme.zip" alt="Download Me!">Click to download</a>'; } document.form.time.value = secondsleft; setTimeout("countdown()",1000); } countdown(); --></script> Code (markup): This is free for anyone to use, and although some form of credits are not needed, they are appreciated. It should be self-explanatory, but if you need any further help - Just ask.
Hey, .. this is how you could do it, but obviously this is not a secure method, since the link is stored in the code itself, if you could get the link through ajax out of a php page, there you could incorporate a timer [ so that the user doesn't play with the javascript to get past the timer and get the link through it as well.. <html> <head> </head> <body> <div id="timerDiv"> </div> <script language="javascript"> var start = 10; timerChange(); function timerChange(){ document.getElementById("timerDiv").innerHTML = start; start--; if (start >= 0){ setTimeout(timerChange, 1000); }else{ document.getElementById("timerDiv").innerHTML = "LINK"; } } </script> </body> </html> HTML:
You just did exactly the same as me. Oh well. Edit: By the way, if you would like, I could add milisecond support to it.
lol, sorry.. i clicked the reply button and then wrote the code.. i guess you must have replied in that while.. Cheers..