How do I make a javascript timer that locks an intro page for 30 second so that visitors can't click "Enter" until the 30 second timer is finished counting down. the 30 second timer needs to be visible on the page.
greetings, fellow internet!
How do I make a javascript timer that locks an intro page for 30 second so that visitors can't click "Enter" until the 30 second timer is finished counting down. the 30 second timer needs to be visible on the page.
http://www.jquery4u.com/tag/jquery-page-lock-timer/
Maybe try something like this in jQuery.
thanks thats almost what i'm looking for. need the page enabled w/ timer at the bottom that enables enter link after 30 seconds.
i dont know javascript/have time to fuck with javascript.
I meant lock an "enter" link, not the whole page. my mistake nigger.
Easiest way is to create the button, set it as disabled, and have a JS timer that removes the disabled attribute.
This also helps eliminate scripting restrictions by requiring them to allow your site/page before they can hit the button if they have noscript or anything similar.Code:<body onload = "setTimeout('enable()', 30000)"> <input type = "button" id = "enter" value = "disabled" onclick = "*whatever it needs to do*" disabled> <script type = "text/javascript"> function enable() { var x = document.getElementById("enter"); x.removeAttribute("disabled"); } setTimeout("enable()", 5000); </script>
Of course, add something in there to let the user know that they need to enable JS, etc... Maybe add a visible timer.
Just what I was looking for, thanks.
How do I make this code display the seconds counting down on the page?
using synja's code, here is one that counts down
have funCode:<html> <head> <script type="text/javascript"> var c=30; // number of seconds to count down from var s=''; // leave this alone lol function enable() { var x = document.getElementById("enter"); if(c!=0){ c==1 ? s='Wait ('+c+' second)' : s='Wait ('+c+' seconds)'; x.value=s; c--;x x.setAttribute("disabled","true"); setTimeout("enable()", 1000); } else { x.removeAttribute("disabled"); x.value="Enter"; } } </script> </head> <body onload="enable()"> <input type="button" id="enter" value="." disabled="disabled"> </body> </html>
Last edited by ionbladez; 03-16-2012 at 04:08 PM. Reason: quick fix
DG p0kEm0n SqUaD 2k11
please use this name on aim or skype. also i code bots.
Making people wait X number of seconds watching advertisements (instead of filling out surveys and zip submits) before they can access content is a great idea. I wonder if there are any ad networks out there that would be down for something like that?
I'm sure there are, since this is what Stickam (sortof), Youtube, and numerous other free content sites are doing. I haven't seen any smaller sites with that type of ad yet so I don't think it's hit mainstream affiliate programs, at least not without purely being a PPC program.
bitch nigga listen.
i am not making people wait x number of seconds watching advertisements.
what i am doing is going to make me $4,500 dollars which I am going to use to go to a place where I am able to successfully repair my psychological foundation and create a work of art that tells the truth about who I am, what happened, when it happened, how it happened, everyone involved, and a long list of others.
thanks for the code it works perfect. i wish there was a way to do this shit in php or html.
is there a way to accomplish the same thing in php or html? someone told me no and that javascript was needed.
thats fucking bullshit, how could php - one of the best languages and most capable languages out there - not be able to set a fucking timer on a page that disables a link/button until the countdown is finished.
seriously.
are you fucking telling me that fucking php can't fucking do a fucking timer lock with a button on a link?
/drunk
so what you are saying is that if i open a new .html file there is no piece of php code that i can put into the file that will accomplish the same thing that the javascript code does in a way where all i have to do is upload the .php or .html and it will work the same as the javascript code???
?
also did not mean any disrespect by calling you bitch nigga my nigger.
its how i express love. you know what i'm saying, bro.
so when i say you're a fucking faggot, what i really mean to say is thanks man.
im emotionally scarred man its not my fault im sorry for real.
PHP executes on the server, JavaScript executes within the browser.
Any effects, timers, or realtime interactions with the user have to be done within the browser. You don't have to use JavaScript, you can use anything that runs within the browser.... JavaScript is just the most convenient method. The user can't see PHP, ASP, or any other server side language until after the code has executed.... in fact, the browser won't see the script at all, just the output of the script in most cases.
another quick question,
is there a way to make two check boxes "yes" and "no" with a button that will go to google.com if the "yes" is checked or go to www.aol.com if the "no" is checked? with HTML? I don't want to have to code up a cgi or php function, but there does not appear to be an 'if' or 'then' in html.
nevermind i figured it out.
Bookmarks