Help - Search - Members - Calendar
Full Version: javascript looping
MSFN Forums > Coding, Scripting and Servers > Web Development (HTML, Java, PHP, ASP, XML, etc.)

   
Google Internet Forums Unattended CD/DVD Guide
Lost Soul
does anybody know of a way i can create a 60 second count down loop with a function of movement for every 1 second ?

i dont want it to show the count down just move text, or an object 1 space every 1 second

any ideals ?
Lost Soul
ok heres my progress so far, ive created a looping count down timer that counts 60 over and over again

QUOTE
<script language="javascript">
<!--
var countdownValue='60';
var countdownValue2='60';

function countdownScript()
{
var showCountdown=document.getElementById('countdown');
showCountdown.innerHTML=countdownValue;
Timer=setTimeout("countdownScript();", 1000);
countdownValue--;
if(countdownValue<0)
{countdownValue=60}
}
//-->
</script>
</head>
<body>
<span id="countdown" style="position:absolute;top:10;left:20"></span>
<script language="javascript">
<!--
countdownScript();
//-->
</script>


now the trick is to have it move an object every second instead of write a number

any ideals any one,, ?
Stalkie
QUOTE (Lost Soul @ Jul 16 2005, 08:13 AM)
ok heres my progress so far, ive created a looping count down timer that counts 60 over and over again

QUOTE
<script language="javascript">
<!--
var countdownValue='60';
var countdownValue2='60';

function countdownScript()
{
var showCountdown=document.getElementById('countdown');
showCountdown.innerHTML=countdownValue;
Timer=setTimeout("countdownScript();", 1000);
countdownValue--;
if(countdownValue<0)
{countdownValue=60}
}
//-->
</script>
</head>
<body>
<span id="countdown" style="position:absolute;top:10;left:20"></span>
<script language="javascript">
<!--
countdownScript();
//-->
</script>


now the trick is to have it move an object every second instead of write a number

any ideals any one,, ?
*



Try with some CSS, probarly something like this:
CODE
var showCountdown=document.getElementById('countdown');
showCountdown.innerHTML=countdownValue;
showCountdown.style['top'] += 1;
Lost Soul
hmm interesting ill see what i can work out thqanks for your ideal
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.