Click to See Complete Forum and Search --> : count down and link
slimjim
06-13-2004, 09:39 AM
I have the below javascript, and it counts down from 10 in a form text box, once it hits 0 it says " GO " in the text box. What i want it to do, is to show a clickable link instead of " GO "
Problem i have when i just add the link inplace of the GO, it shows the link tag and nothing is clickable. can anyone help me out here.
Please....
<script language='JavaScript'>
function watcher() {
if (tmr.value>0) tmr.value--;
if (tmr.value==0) tmr.value = "GO";
}
setInterval("watcher()", 1000);
</script>
The Link
<A target=_top href='../start.php?uid=$uid&topframe=1&grp_id=$grp_id&auth=$auth'>SURF MORE</A>
Pittimann
06-13-2004, 10:11 AM
Hi!
You could put your link in a hidden div, span, table cell or something and make it visible when zero has been reached. Or you can just make a redirect after these ten seconds without showing the link (user doesn't have to click; after 10 seconds the desired page is loaded).
Cheers - Pit
slimjim
06-13-2004, 10:19 AM
Can you give me an example of the hidden link when it hits 0, not sure how to implement this.
Pittimann
06-13-2004, 10:33 AM
Hi!
Example:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
function watcher() {
var tmr=document.forms[0].tmr;
if (tmr.value>0) tmr.value--;
if (tmr.value==0){
tmr.value = "GO";
clearInterval(timer);
document.getElementById('myLink').style.display='block';
}
}
var timer=setInterval("watcher()", 1000);
//-->
</script>
</head>
<body>
<form><input name="tmr" value=10></form>
<div id="myLink" style="display:none">
<A target=_top href='../start.php?uid=$uid&topframe=1&grp_id=$grp_id&auth=$auth'>SURF MORE</A>
</div>
</body>
</html>Cheers - Pit
Pittimann
06-13-2004, 11:58 AM
Hi!
In reply to your latest pm:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
function watcher() {
var tmr=document.getElementById('tmr');
if (tmr.value>0) tmr.value--;
if (tmr.value==0){
tmr.value = "GO";
clearInterval(timer);
document.getElementById('myLink').style.display='block';
}
}
var timer=setInterval("watcher()", 1000);
//-->
</script>
</head>
<body>
<table><tr><td width="22%" bgcolor="#0000FF"><p align="center"><font color='#FFFFFF'><b> Wait to get credits: </b></font><input size='3' type='text' name='tmr' id='tmr' value=10 style="font-family: Verdana; font-size: 10pt; color: #003399; font-weight: bold; text-align:center"></p></td></tr></table>
<div id="myLink" style="display:none">
<A target=_top href='../start.php?uid=$uid&topframe=1&grp_id=$grp_id&auth=$auth'>SURF MORE</A>
</div>
</body>
</html>My previous suggestion couldn't work because your input is not inside a form...
Cheers - Pit
slimjim
06-13-2004, 02:17 PM
Worked perfect, i had to put the table between <? ?> so that the vaiables in the link worked, other then that, GREAT
Thank You for your professional expertise and time
Pittimann
06-13-2004, 02:39 PM
Hi!
Glad, that it helped! You're welcome.
Cheers -Pit