Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

15 sec countdown function?

Status
Not open for further replies.

natureboy76

Programmer
Oct 2, 2010
8
US
Hey guys I have all my work done on this web page except the last part I can't seem to get....I need to create a startCountdown function so it changes the value assigned to the text field in the body to the value of a variable named count, which decreases by a value of one (from 15 to 1)..I've gotten everything else to work...Here is my program so far:

<html xmlns="<head>
<title>Central Valley Realtors</title>
<script type="text/javascript">
/* <![CDATA[ */
var startAdPAge() {
location.href="CVR2.html";
}
/* ]]> */
</script>
</head>
<body onload="startAdPAge =
setinterval('cvr2()', 15000);">

<table width="75%">
<tr>
<td>
<img src="cvb1.gif" height="300" width="425" alt="Changing advertising image" />
</td>
<td align="center">
<p>
<strong>Advertisement</strong></p>
<form action="" name="timerForm">
<p>
The Central Valley Realtors home page will display in
<input type="text" name="timeLeft" size="1" value="15" style="background-color: Transparent;
border: none; overflow: hidden; font: 10px tahoma; color: #3F3F3F" />
seconds</p>
<p>
<a href="CVR2.html">Skip advertisement</a></p>
</form>
</td>
</tr>
</table>
</body>
 
I forgot to add that when the countdown reaches zero I need to clear both intervals and redirect the browser to the CVR2.html. Everything else works but the damn countdown and this lol.
 
I need to create a startCountdown function so it changes the value assigned to the text field in the body to the value of a variable named count, which decreases by a value of one (from 15 to 1)

You've described pretty much what your code should look like... the only thing you don't have is a timer that fires every second.

Give it a go with a 1-second timer, following your own pseudo-code - I'm sure you'll get it in no time.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Snippets & Info:
The Out Atheism Campaign
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top