...

View Full Version : Timed button



Varmistuskoodi
11-22-2010, 01:04 PM
I need an timed button. When you come to site, you must wait in that site ?? seconds and then button comes pressable. :confused:

durangod
11-22-2010, 01:13 PM
never done a timed button before but i have done a timeout on a page, so you could play with this and take them to a page initially without the button then when they timeout it takes them to the page with the button... just a dif way of doing it.. here is the code to timeout a page



<script>
<!--
//change below target URL to your own
var targetURL="whatever.php"
//change the second to start counting down from
var countdownfrom=30

var currentsecond=document.redirect.redirect2.value=countdownfrom+1
function countredirect(){
if (currentsecond!=1){
currentsecond-=1
document.redirect.redirect2.value=currentsecond
}
else{
window.location=targetURL
return
}
setTimeout("countredirect()",1000)
}

countredirect()
//-->
</script>

Varmistuskoodi
11-22-2010, 01:31 PM
never done a timed button before but i have done a timeout on a page, so you could play with this and take them to a page initially without the button then when they timeout it takes them to the page with the button... just a dif way of doing it.. here is the code to timeout a page



<script>
<!--
//change below target URL to your own
var targetURL="whatever.php"
//change the second to start counting down from
var countdownfrom=30

var currentsecond=document.redirect.redirect2.value=countdownfrom+1
function countredirect(){
if (currentsecond!=1){
currentsecond-=1
document.redirect.redirect2.value=currentsecond
}
else{
window.location=targetURL
return
}
setTimeout("countredirect()",1000)
}

countredirect()
//-->
</script>



Eh, don't know what do remove / add. Please, just code for that?

durangod
11-22-2010, 01:48 PM
ok if you want to take them to a waiting page and have that page timeout then take them to a page with the button it will be like this

im assuming this is in a php file if not let me know.


first place this at the bottom of your php file after the ?>

change the target URL to the page that you want them to go to after they wait. and change the countdownfrom to how long you want them to wait, its set now at 30 sec.. it will countdown from 30 sec then take them to the page you want..



<script>
<!--
//change below target URL to your own
var targetURL="yourpage.php"
//change the second to start counting down from
var countdownfrom=30

var currentsecond=document.redirect.redirect2.value=countdownfrom+1
function countredirect(){
if (currentsecond!=1){
currentsecond-=1
document.redirect.redirect2.value=currentsecond
}
else{
window.location=targetURL
return
}
setTimeout("countredirect()",1000)
}

countredirect()
//-->
</script>




now display the counter on your page so they can see it. again this is written for a php file..

you can post this code below whereever you want to display the timer..




echo "<form name='redirect'><center>
<font face='Arial'><b>You will be redirected to a different page in<br /><br /> <form>
<input type='text' size='3' name='redirect2' /></form>
seconds</b></font></center>";




does that help you

connollyc4
11-22-2010, 01:55 PM
Something like this?



<html>
<head>
<script type="text/javascript">

window.onload=function(){

setTimeout(enableIt,5000)

}

function enableIt(){

document.getElementById('send').disabled=false;

}

</script>
</head>
<body>

<input id="send" type="submit" disabled="disabled" name="send" value="submit"/>
</body>
</html>

Varmistuskoodi
11-22-2010, 04:04 PM
Something like this?



<html>
<head>
<script type="text/javascript">

window.onload=function(){

setTimeout(enableIt,5000)

}

function enableIt(){

document.getElementById('send').disabled=false;

}

</script>
</head>
<body>

<input id="send" type="submit" disabled="disabled" name="send" value="submit"/>
</body>
</html>


*Thanks this user*
Thank you! Just what I did need!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum