Current location: Hot Scripts Forums » General Web Coding » JavaScript » Countdown Timer Question


Countdown Timer Question

Reply
  #1 (permalink)  
Old 07-03-05, 03:38 PM
Dominate_Predator Dominate_Predator is offline
New Member
 
Join Date: Jul 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question Countdown Timer Question

I put a timer on my website and when I try to put a additional one on the same page it does not load or when it does the other stops counting..???

Any ideas how to correct this..
Reply With Quote
  #2 (permalink)  
Old 07-03-05, 03:44 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
If you used a script intended to display a single timer you are probably experiencing "interference" between the scripts. Most likely, the script uses a couple of variables to keep track of key values. If you do not rename these varaibles in one of the scripts they will cancel eachother out. (Even if they are placed in different <script> tags.)

It's not possible to tell eaxtly why it's not working because you haven't included the actual script in your post. Use [code ] [/code ] wrappers for that or post a link to it.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
  #3 (permalink)  
Old 07-03-05, 04:44 PM
Dominate_Predator Dominate_Predator is offline
New Member
 
Join Date: Jul 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Code:
<script>//change the text below to reflect your own,
var before="Paul, Mark, Larry & Chris Move Like Gypsies To Elk Hunt..!!!!"
var current="Season On...Good Luck Guys...!"
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

function countdown(yr,m,d){
theyear=yr;themonth=m;theday=d
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
futurestring=montharray[m-1]+" "+d+", "+yr
dd=Date.parse(futurestring)-Date.parse(todaystring)
dday=Math.floor(dd/(60*60*1000*24)*1)
dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
if(dday==0&&dhour==0&&dmin==0&&dsec==1){
document.forms.count.count2.value=current
return
}
else
document.forms.count.count2.value="Only "+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+before
setTimeout("countdown(theyear,themonth,theday)",1000)
}
//enter the count down date using the format year/month/day
countdown(2005,09,01)
</script>
Reply With Quote
  #4 (permalink)  
Old 07-03-05, 04:47 PM
Dominate_Predator Dominate_Predator is offline
New Member
 
Join Date: Jul 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Hope thats what you wanted...The countdown ending time is the same
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
auction countdown timer like in ebay edwient PHP 2 05-12-05 01:19 AM
countdown timer misterman JavaScript 1 03-22-05 01:35 PM
Need a countdown clock Tocpe Script Requests 1 10-17-04 08:38 AM
[PHP] Array question UmiSal Script Requests 1 04-05-04 01:52 PM
question and answer software jaydifox C/C++ 0 02-21-04 09:26 AM


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