Current location: Hot Scripts Forums » General Web Coding » JavaScript » Help making Count-up script


Help making Count-up script

Reply
  #1 (permalink)  
Old 06-25-04, 08:58 PM
Psykho Psykho is offline
Newbie Coder
 
Join Date: Jul 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Help making Count-up script

Hello, I've currently got an mp3 player made, and I need some help with an addon. I'm trying to make a script that starts at 0:00 when a link is clicked, and stops when a set-time is reached.

Example: Link is clicked, timer starts at 0:00 and counts up to the end of the song which would be at 4:00. When the timer hits 4:00, I want it to stop, and do no more counting past 4:00. Then, when another link is clicked, clear the 4:00 spot and start back at 0:00 and count up to the end of that song.

If anyone would help me put that together, rather than tell me useless garbage like "it can be done in javascript" or "you should use the onClick function," I'd greatly appreciate it. Bye.
Reply With Quote
  #2 (permalink)  
Old 06-26-04, 06:10 PM
dawggy505 dawggy505 is offline
Newbie Coder
 
Join Date: May 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
you should use the setTimeout and clearTimeout functions. lol! jk. u really do need to use them though. i made an example for you

Code:
  
 
var count = 0;  // Set the count
var the_timeout;  // Declare the timeout
function timer()
{
window.document.form_1.the_text.value = count; // Declare the form value is the count
the_count += 1;
the_timeout = setTimeout("timer();", 1000);
}
function clearIt()
{
clearTimeout(the_timeout);  // Clear the timeout
}
if {
count == 240;  // 240 seconds is 4 minutes...
clearTimeout(the_timeout);
}
And then add the html button looking like this:

<form name="form_1" method="post">
<input type="text" name="the_text"><br /><br />
<input type="button" onClick="timer();"><br />
<input type="button" onClick="clearIt();">
</form>
Reply With Quote
  #3 (permalink)  
Old 06-26-04, 06:13 PM
dawggy505 dawggy505 is offline
Newbie Coder
 
Join Date: May 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Now this isn't EXACTLY what you wanted because it doesn't start at "0:00", but it has the basic idea to it. hope it helps!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any integrity of script rankings? webmaster@atmanager.com Hot Scripts Forum Questions, Suggestions and Feedback 17 08-06-04 12:12 AM
making a print script darkcarnival PHP 5 05-16-04 03:34 AM
Please help me with my problem of MP3 and php know script for making mp3 portal??? Extremaltours Script Requests 3 01-30-04 07:59 AM
Help making a script. Arctic ASP 0 10-02-03 06:50 PM
Help with making a installer config script dazz Job Offers & Assistance 3 09-29-03 02:51 AM


All times are GMT -5. The time now is 10:24 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.