JavaScript - Countdown Timer Resetting Every Day At Specific Time
Hello everyone,
I am completely new to javascripts. I want to have a count down timer on my webpage. I already found a script, but it does not do everything I want it to do. I couldn't find a script that did everything I need. I need it to do the following things: - Use the time zone GMT+1 - Reset everyday at a specific time - From 15:00 till 17:30: A countdown (so it shows 2 hours and 30 minutes from the start and count's down to 0 (which will be 17:30) - During 15:00 till 17:30 it shows: "The game is playing" - Once it is 17:30 I want it to reset and countdown till the next day 15:00 - From 17:30 till 15:00 next day it says: "The game will start in" So it is actually 2 countdown clocks in one javascript. One countdown from 15:00 to 17:30 (whilst the game is playing) and one directly starting after it from 17:30 till 15:00 next day. But both are displayed on the same spot. The countdown will be in text. No buttons or fancy images etc. Hope you can help me out. Thanks Code: <html> <head> <script type = "text/javascript"> function getSeconds() { var now = new Date(); var time = now.getTime(); // time now in milliseconds var midnight = new Date(now.getFullYear(),now.getMonth(),now.getDate(),0,0,0); // midnight 0000 hrs // midnight - change time hh,mm,ss to whatever time required, e.g. 7,50,0 (0750) var ft = midnight.getTime() + 86400000; // add one day var diff = ft - time; diff = parseInt(diff/1000); if (diff > 86400) {diff = diff - 86400} startTimer (diff); } var timeInSecs; var ticker; function startTimer(secs){ timeInSecs = parseInt(secs); ticker = setInterval("tick()",1000); tick(); // to start counter display right away } function tick() { var secs = timeInSecs; if (secs>0) { timeInSecs--; } else { clearInterval(ticker); // stop counting at zero //getSeconds(); // and start again if required } var hours= Math.floor(secs/3600); secs %= 3600; var mins = Math.floor(secs/60); secs %= 60; var result = ((hours < 10 ) ? "0" : "" ) + hours + " hours " + ( (mins < 10) ? "0" : "" ) + mins + " minutes " + ( (secs < 10) ? "0" : "" ) + secs + " seconds"; document.getElementById("countdown").innerHTML = "The game will start in " + result; } </script> </head> <body onload = "getSeconds()"> <span id="countdown" style="font-weight: bold;"></span> </body> </html> Reply With Quote 01-07-2015, 10:11 PM #2 Old Pedant View Profile View Forum Posts Supreme Master coder! Join Date Feb 2009 Posts 28,311 Thanks 82 Thanked 4,754 Times in 4,716 Posts First of all, move your JavaScript where it belongs: Just before the </body> tag. Then you don't need stuff such as onload='....' Here's my attempt at it: Code: <!DOCTYP html> <html> <head> <title>Game play starts at 17:30</title> </head> <body> Other stuff...<br/><br/> <span id="countdown" style="font-weight: bold;"></span> <br/><br/>Other stuff...<br/><br/> <script type="text/javascript"> var timer = null; function tick( ) { var msg = document.getElementById("countdown"); var now = new Date(); var yr = now.getFullYear(); var mon = now.getMonth(); var dy = now.getDate(); var startat = new Date(yr,mon,dy,15,0,0); var endat = new Date(yr,mon,dy,17,30,0); if ( now.getTime() < startat.getTime() ) { msg.innerHTML = "The game will start at 17:30"; } else if ( now.getTime() > endat.getTime() ) { msg.innerHTML = "The game started at 17:30"; } else { var sec = Math.floor( ( endat.getTime() - now.getTime() ) / 1000 ); var min = Math.floor ( sec / 60 ); sec %= 60; var hr = Math.floor ( min / 60 ); min %= 60; if ( min < 10 ) min = "0" + min; if ( sec < 10 ) sec = "0" + sec; msg.innerHTML = "The game will start in " + hr + ":" + min + ":" + sec; } } tick(); // immediate start timer = setInterval( tick, 1000 ); // every second </script> </body> </html> Similar TutorialsHi All, I am trying to set up a countdown function that will be called on the click of a button. Function is below Code: function countDown(sec, min) { sec--; if (sec == -01) { sec = 59; min = min - 1; } else { min = min; } if (sec<=9) { sec = "0" + sec; } time = (min<=9 ? "0" + min : min) + " min and " + sec + " sec "; if (document.getElementById) { theTime.innerHTML = time; } SD=window.setTimeout("countDown();", 1000); if (min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD); } } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } addLoadEvent(function() { }); However I get an error after one second. Script can be found here - http://www.jivalot.co.uk/m.php Can anyone help? Kind regards, Slate I am making a website and the page is oriented around a countdown system. If the timer ever reaches 0, the whole thing will stop. Below are the specifics: I need a countdown timer that runs from 30 seconds to 0 seconds. If the timer is at 0 seconds, the script runs php code #1 (which makes the timer stop and if any user refreshes the page, it will still stay at zero). There is also two buttons. If user clicks on button #1, the timer will get reset to 30 seconds remaining. Then the script will run the php code #2 (which allows the timer to begin counting down again from 30 seconds). If user clicks on button #2, the timer will get reset to 5 seconds remaining and same thing follows as the first button. And obviously the timer should show the same number (seconds remaining) for all the users on the website! Thank You Please understand that i have looked through the different timers on the JavaScript section but did not find any that can do what i am looking for and i don't know programming to edit any of them. I would like to have a countdown timer on my website that will count down from 12:00:01 am server time and end at midnight again of the same day (the clock should count down a full 24 hours) then it will automatically reset itself and count down again each and every day starting from 1 second after midnight. The count down should display hours : minutes : seconds just like a digital watch. I would also like to it to go with the server time and not client computer time so it will only count down according to the server time. One more thing .... each day a new trivia question will be posted and ppl have 1 day to answer the trivia question for a chance to win something (that is why the script is counting down). Will the script be able to automatically load a new trivia each day at midnight as the timer resets or do i have to load the trivia manually? If im getting way out of my head here then lets forget this last part. If it can be done i will certainly appreciate the advice. index.php Code: <a href="#" onClick="getTimer();return false;">Show Timer</a> <br /> <div id="test"></div> getTimer.js Code: function getTimer() { new Ajax.Request('filegoeshere', { onSuccess: function(req) {eval(req.responseText);}, onFailu function(){ alert('Something went wrong...') } }); } timer.php Code: <?php echo "$('test').innerHTML = '<form><input type=\"text\" name=\"timer\" id=\"timer\" size=\"8\" style=\"text-align: center;\" /></form>';"; ?> var seconds= 30 $('timer').value='30' function display() { seconds--; if (seconds<=-1){ seconds=30 } else $('timer').value=seconds; setTimeout("display()",1000) } display() Everything seems to work, but the once the timer is in the input box, after the request, it get's stuck on 29, and will not continue counting down, and I can't seem to get it to work. I am using ProtoType with this, and I did just take that little part out of the index.php file, since that is all that is needed from that file. hi, i am currently trying to write a javascript program; it would be for a library reservation system. this would be put on the computers with sessions from 15 minutes to 2 hours (in 15 minute chunks i.e, 15, 30, 45, 1 hour). this program would countdown the remaining time on their session, with pop-up messages appearing every so often. at the end of the session, the program will have to automatically log the user off. i am a student studying javascript, and haven't got any idea how to even start can anyone give me a helping hand to get me started. thanks Hi guys, I'm building a page which has a countdown timer on it (days, hours, mins) and I honestly really don't know much about Javascript at all. I have spent over half a day looking through tutorials and code snippets and think I'm close, but I'm still having trouble with the output. I need to pull out the days/hours/mins separately as they sit within different HTML elements. The days appear to be displaying correctly, but the hours is showing 3 digits instead of 2 and the mins is showing 5 digits instead of 2: 32 days, 764 hours, 45845 mins Here is the code I'm using: Code: var now = new Date(); var theevent = new Date("June 18 2011 10:00:00"); var seconds = (theevent - now) / 1000; var mins = seconds / 60; var hours = mins / 60; var days = hours / 24; ID=window.setTimeout("update();", 1000); function update() { now = new Date(); seconds = (theevent - now) / 1000; seconds = Math.round(seconds); mins = seconds / 60; mins = Math.round(mins); hours = mins / 60; hours = Math.round(hours); days = hours / 24; days = Math.round(days); document.getElementById('days').innerHTML = days; document.getElementById('hours').innerHTML = hours; document.getElementById('mins').innerHTML = mins; ID=window.setTimeout("update();",1000); } Thanks a bunch in advance... Hi everyone, I need a countdown timer that will count down exactly from a time that i set. i want it to count in this format: hh:mm:ss. i need it for a online shop , at the main page there are few products for sell and i want each one of them to have its own countdown timer. in addition when it will get to 00:00:00 i want that it will automatically add like 5 hours and continue counting down.. P.s i dont know javascript.. thanks guys I found this countdown timer online that starts when the page loads at 30 seconds and counts down to zero. What I need for it to do however is once it hits 0 it needs to automatically reset itself back to 30 seconds. It's being used in conjunction with a online (not a chat room) chatterbot where people often abuse the bot with foul language. The idea being to stop them from entering text to the bot for 30 seconds. I'm using these lines in the chatterbot where xxx would be the foul language. The stopTalk part prevents entering text for 30 seconds. The display() triggers the countdown. However, once it hits 0 it's dead in the water. If someone types another bad word the timer isn't going to work. Note: The timer is just a visual diplay so the user can see how long he must wait. The StopTalk below is working fine to stop the user from entering text. That part isn't the problem. Code: if (input.search("xxx")!= -1) {document.result.result.value = "Stop the foul language. You can no longer enter text for 30 seconds"; display() stopTalk = setTimeout('icon.src=icon1.src;stopTalk=false;',30000) return true;} 1) Because this is an online chatterbot that temporarily stores information about the user I can't restart the timer by refreshing the page or I would lose that information. 2) I don't want to use a button to reset the timer. If at all possible I want the timer to reset automatically. Any help would be appreciated. Code: <form name="counter"><input type="text" size="8" name="d2"></form> <script> <!-- // var milisec=0 var seconds=30 document.counter.d2.value='30' function display(){ if (milisec<=0){ milisec=9 seconds-=1 } if (seconds<=-1){ milisec=0 seconds+=1 } else milisec-=1 document.counter.d2.value=seconds+"."+milisec setTimeout("display()",100) } display() --> </script> Hi, Im looking for a simple script or solution that will allow a timer to count down 48hrs from a set time of the day and then after that reset and start the process again. For Example: Order within 23 hours 6 minutes for Delivery Tommorow The problem I have got is im not sure how to create a timer that does not reset every time you refresh the browser etc. Any hep would be great as im stumped with this one! Thanks Hi. I'm looking for a simple JS countdown timer for a quiz that counts down 60 seconds. I've done a lot of searching and have found plenty of countdown timers for a specific time/date in the future, but nothing for my needs. I just want it to count down from 60 seconds to zero. Thanks a lot for your help! Hi folks, I am in need of a functionality for a system where in there is PHP mysql system having a table "bid" which has columns(bid_product, "createtime") basically if the user does not bid for the product within 20 hours the bid will close for this i need to display a timer which keeps counting till 5+ hours or so of the createtime, After a tiring search for timers i finally found a .Js which would work just fine for static values Within the .js script when i tried to pass values from my database the timer does not change on itself but each time i have to refresh the page to check the time left. Please have a look at the code and let me know what could be wrong testingtime.php Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Vott</title> <script type="text/javascript" src="js/testtime.js"></script> <style> p.timer{font-size:15px; color:#43C6DB; border: 2px solid #fc0;width: 100px; position: absolute; top: 350px; left: 375px;} </style> </head> <body> <table style="background-color: #CCC" width="100%" border="0" cellpadding="12"> <tr> <td width="78%"><h1>My Logo Image</h1></td> </tr> </table> <span class="bids"> <p class="timer"><b>bid Closes in :</br> <span id="timeleft"> <script>timeleft('<?php print($bid['createtime']); ?>')</script> </span></b></p></span></br></br> </body> </html> The Javascript code Code: var eventtext = "Left"; // text that appears next to the time left var endtext = "bids Closed!!"; // text that appears when the target has been reached function timeleft(mydate){ // Split timestamp into [ Y, M, D, h, m, s ] var t = mydate.split(/[- :]/); // Apply each element to the Date function var date = new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]); // -> Wed Jun 09 2010 13:12:01 GMT+0100 (GMT Daylight Time) var year = date.getYear(); // in what year will your target be reached? var month = date.getMonth(); // value between 0 and 11 (0=january,1=february,...,11=december) var day = date.getDate(); // between 1 and 31 var hour =date.getHours(); // between 0 and 24 var minute = date.getMinutes(); // between 0 and 60 var second = date.getSeconds(); // between 0 and 60 var end = new Date(year,month,day,hour,minute,second); end.setMinutes(end.getMinutes() + 50); var now = new Date(); if(now.getYear() < 1900) yr = now.getYear() + 1900; var sec = end.getSeconds() - now.getSeconds(); var min = end.getMinutes() - now.getMinutes(); var hr = end.getHours() - now.getHours(); var dy = end.getDate() - now.getDate(); var mnth = end.getMonth() - now.getMonth(); var yr = year - yr; var daysinmnth = 32 - new Date(now.getYear(),now.getMonth(), 32).getDate(); if(sec < 0){ sec = (sec+60)%60; min--; } if(min < 0){ min = (min+60)%60; hr--; } if(hr < 0){ hr = (hr+24)%24; dy--; } if(dy < 0){ dy = (dy+daysinmnth)%daysinmnth; mnth--; } if(mnth < 0){ mnth = (mnth+12)%12; yr--; } var sectext = " Seconds "; var mintext = " Minutes, and "; var hrtext = " Hours, "; var dytext = " Days, "; var mnthtext = " Months, "; var yrtext = " Years, "; if (yr == 1) yrtext = " Year, "; if (mnth == 1) mnthtext = " Month, "; if (dy == 1) dytext = " Day, "; if (hr == 1) hrtext = " Hour, "; if (min == 1) mintext = " Minute, and "; if (sec == 1) sectext = " second "; if(now >= end){ document.getElementById("timeleft").innerHTML = endtext; clearTimeout(timerID); } else{ //alert(now.getHours()+1); document.getElementById("timeleft").innerHTML =min + ":" + sec; //document.getElementById("timeleft").innerHTML = dy + dytext + hr + ":" + min + ":" + sec; } timerID = setTimeout("timeleft()", 1000); } window.onload = timeleft; Ok, I have been trying for the last week to get my head around this javascript thing to create myself a countdown timer. And after many search keywords in whatever search engine I still couldn't find any good results which could meet my needs. I actually found a cute little script here on the forum, but unfortunately, and after many times trying, couldn't make it work for me as well. Yes it did what it was supposed to do, but I need something more specific. So here's the thing. I am working with PHP variables and need two countdown timers on one page. I have altered the script in various ways, and it kinda works, but whenever it starts running, the top countdown timer starts with the correct amount of seconds but then jumps to the same output as the below one. Code: <span id = \"closingtimer". $target ."\">". $seconds ."</span> <script type=\"text/javascript\"> var seconds = ". $seconds ."; function display". $target ."() { seconds --; if (seconds < 1) { closeMyAd(); } else { document.getElementById( \"closingtimer". $target ."\" ).innerHTML = seconds ; setTimeout(\"display". $target ."()\", 1000); } } display". $target ."(); </script> $target is a variable from the Db $seconds is the amount of seconds The script IS in a loop to be able to perform the function twice for the two different targets with their amount of seconds. Due to this (I suspect) the timer is counting down at 2 seconds at a time, which also is quite annoying Target 1 has 2400 seconds and target 2 has 1600 seconds. How can I make this work correctly and without having a huge script in the middle of my page? Hi there, Hopefully someone will be able to help me here. I found the below script that works fine for the actual countdown, but when the user refreshes the page, the countdown starts from 5 minutes again. What I am trying to do, is handle users that put something in their shopping cart and then get side tracked or what ever reason and that same product then being purchased by another person when I only have 1 left. So using PHP I am going to subtract the qty of that product by 1 and then I want the website to either put it back, if the users checkout times out, or if a normal process it is taken out permanently. So long story short I think I need some sort of 'memory' for the javascript, so the user can't just keep refreshing and it starting from 5 minutes each time. Also it needs to be carried through to other pages. Your help is greatly appreciated. Thanks, Simon. Code: <script type="text/javascript"> /* This script and many more are available free online at The JavaScript Source :: http://javascript.internet.com Created by: Neill Broderick :: http://www.bespoke-software-solutions.co.uk/downloads/downjs.php */ var mins var secs; function countdown() { mins = 1 * CDm("5"); // change minutes here secs = 0 + CDs(":01"); // change seconds here (always add an additional second to your total) CDredo(); } function CDm(obj) { for(var i = 0; i < obj.length; i++) { if(obj.substring(i, i + 1) == ":") break; } return(obj.substring(0, i)); } function CDs(obj) { for(var i = 0; i < obj.length; i++) { if(obj.substring(i, i + 1) == ":") break; } return(obj.substring(i + 1, obj.length)); } function CDdis(mins,secs) { var disp; if(mins <= 9) { disp = " 0"; } else { disp = " "; } disp += mins + ":"; if(secs <= 9) { disp += "0" + secs; } else { disp += secs; } return(disp); } function CDredo() { secs--; if(secs == -1) { secs = 59; mins--; } document.getElementById("countdown").firstChild.nodeValue = CDdis(mins,secs); //document.cd.disp.value = dis(mins,secs); // setup additional displays here. if((mins == 0) && (secs == 0)) { window.alert("Time is up. Press OK to continue."); // change timeout message as required // window.location = "yourpage.htm" // redirects to specified page once timer ends and ok button is pressed } else { countdown = setTimeout("CDredo()",1000); } } function coundowninit() { countdown(); } </script> Code: <span id="countdown"> </span> Hi there. I am wanting to create a countdown timer that is based on a SELECT feature. If a user selected 15 MINUTES, the script would know 15 minutes was selected and would prompt start to time down when selected. Or if the user selected 30 MINUTES it would go to countdown from 30 minutes. I would also like a stopwatch feature on there if STOPWATCH was selected. It would also be great if when counting down the background box of the timer turns red to visually show the timer had gone over and start counting back up in minus to show how many minutes/seconds it has gone over. I've looked on good old Google but can't find a code i'm looking for! Thanks Ash Hi guys. I'm making a webpage for a school project and I need help modifying this timer he http://web.mac.com/rkuhnhenn/Countdo.../Style_3b.html I want it to countdown from 48 hours, and as soon as it counts down, I need it to reset. I need an endless countdown of 48 hours. How can I go about doing that? Thanks guys, your help is highly appreciated. I'm going crazy trying to figure this out. What I'm looking for is a javascript timer / count down script. When the hours, minutes and seconds hit 0, I need a button the page to become enabled and I also need a button to pause the timer and start it. I have the following code so far. Willing to pay $50 for solution...
Code: <html> <head> <title>Countdown</title> <script type="text/javascript"> // how many minutes var mins = 30; // how many seconds var secs = mins * 60; function countdown() { setTimeout('Decrement()',1000); } function Decrement() { if (document.getElementById) { minutes = document.getElementById("minutes"); seconds = document.getElementById("seconds"); // if less than a minute remaining if (seconds < 59) { seconds.value = secs; } else { minutes.value = getminutes(); seconds.value = getseconds(); } secs--; if(secs > 0) { setTimeout('Decrement()',1000); } } } function getminutes() { // minutes is seconds divided by 60, rounded down mins = Math.floor(secs / 60); return mins; } function getseconds() { // take mins remaining (as seconds) away from total seconds remaining return secs-Math.round(mins *60); } </script> </head> <body onload="countdown();"> Countdown: <form><input id="minutes" type="text" style="width: 22px;"> minutes <input id="seconds" type="text" style="width: 22px"> seconds remaining.</form> </body> </html> Code: <script language="JavaScript"> TargetDate = "12/5/2009 12:00 PM"; BackColor = "grey"; ForeColor = "white"; CountActive = true; CountStepper = -1; LeadingZero = true; DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds."; FinishMessage = "Its finally here"; </script> <script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script> i found this code on a website. it is a countdown timer. and i wanted to put it on a forum. but i think there will be a problem when others view it.. i think that other people from different time zones will see the time countdown different times.. is there a way to include a specific time zone (i.e. mine?) in this code? BTW its suppose to go to December 5, 2009. i am in GMT-6 Central Time. I'm trying to place a countdown timer i have in a specific spot on a website I'm building......any thoughts on how i would do this?
OK well one I have tried to contact the author of this application and he no longer writes or supports it and I know nothing about javascript... so here I am BEGGING FOR HELP!!! any body will to give this a go would love to try anything here is my problem the timer is self works fine but since new updates (RECENT) in Chrome and Firefox when you move away from the window it stop the count then when you come back to it the count starts again I dont want the count to stop any ideas would be great Code: window.onload=progressBarInit; // Timer Bar - Version 1.0 // Author: Brian Gosselin of http://scriptasylum.com var loadedcolor='<?php echo $gSurfLoadColour; ?>' ; // PROGRESS BAR COLOR var unloadedcolor='<?php echo $gSurfUnloadColour; ?>'; // COLOR OF UNLOADED AREA var bordercolor='<?php echo $gSurfLoadBoardColour; ?>'; // COLOR OF THE BORDER var barheight=15; // HEIGHT OF PROGRESS BAR IN PIXELS var barwidth=190; // WIDTH OF THE BAR IN PIXELS var waitTime=<?php echo $gSurfTimer - $members_time_deduct; ?>; // NUMBER OF SECONDS FOR PROGRESSBAR // THE FUNCTION BELOW CONTAINS THE ACTION(S) TAKEN ONCE BAR REACHES 100%. // IF NO ACTION IS DESIRED, TAKE EVERYTHING OUT FROM BETWEEN THE CURLY BRACES ({}) // BUT LEAVE THE FUNCTION NAME AND CURLY BRACES IN PLACE. // PRESENTLY, IT IS SET TO DO NOTHING, BUT CAN BE CHANGED EASILY. // TO CAUSE A REDIRECT TO ANOTHER PAGE, INSERT THE FOLLOWING LINE: // window.location="http://redirect_page.html"; // JUST CHANGE THE ACTUAL URL OF COURSE :) //*****************************************************// //********** DO NOT EDIT BEYOND THIS POINT **********// //*****************************************************// var ns4=(document.layers)?true:false; var ie4=(document.all)?true:false; var blocksize=(barwidth-2)/waitTime/10; var loaded=0; var PBouter; var PBdone; var PBbckgnd; var Pid=0; var txt=''; if(ns4){ txt+='<table border=0 cellpadding=0 cellspacing=0><tr><td>'; txt+='<ilayer name="PBouter" visibility="hide" height="'+barheight+'" width="'+barwidth+'">'; txt+='<layer width="'+barwidth+'" height="'+barheight+'" bgcolor="'+bordercolor+'" top="0" left="0"></layer>'; txt+='<layer width="'+(barwidth-2)+'" height="'+(barheight-2)+'" bgcolor="'+unloadedcolor+'" top="1" left="1"></layer>'; txt+='<layer name="PBdone" width="'+(barwidth-2)+'" height="'+(barheight-2)+'" bgcolor="'+loadedcolor+'" top="1" left="1"></layer>'; txt+='</ilayer>'; txt+='</td></tr></table>'; }else{ txt+='<div id="PBouter" style="position:relative; visibility:hidden; background-color:'+bordercolor+'; width:'+barwidth+'px; height:'+barheight+'px;">'; txt+='<div style="position:absolute; top:1px; left:1px; width:'+(barwidth-2)+'px; height:'+(barheight-2)+'px; background-color:'+unloadedcolor+'; font-size:1px;"></div>'; txt+='<div id="PBdone" style="position:absolute; top:1px; left:1px; width:0px; height:'+(barheight-2)+'px; background-color:'+loadedcolor+'; font-size:1px;"></div>'; txt+='</div>'; } function incrCount(){ window.status="<?php echo $gSurfWStatusCD; ?>"; loaded++; if(loaded<0)loaded=0; if(loaded>=waitTime*10){ clearInterval(Pid); loaded=waitTime*10; setTimeout('hidebar()',100); } resizeEl(PBdone, 0, blocksize*loaded, barheight-2, 0); //alert((waitTime+1)-Math.ceil(loaded/10)); tempcnt = (waitTime+1)-Math.ceil(loaded/10); document.getElementById('count').innerHTML=tempcnt; } function breaker_bar() { parent.np=1; parent.framesBreaking(false); return true; } function wrong() { parent.wsftpaw.location.replace('../index.php?_w=wrong_button'); } function submitform(id) { parent.np=1; parent.framesBreaking(false); document.surfform.cl.value=id; document.surfform.submit(); } function hidebar(){ document.getElementById('count').innerHTML=0; window.status='<?php echo $gSurfWStatusEnd; ?>'; switchDiv('counter', false,0); switchDiv('buttons', true,0); } //THIS FUNCTION BY MIKE HALL OF BRAINJAR.COM function findlayer(name,doc){ var i,layer; for(i=0;i<doc.layers.length;i++){ layer=doc.layers[i]; if(layer.name==name)return layer; if(layer.document.layers.length>0) if((layer=findlayer(name,layer.document))!=null) return layer; } return null; } function progressBarInit(){ PBouter=(ns4)?findlayer('PBouter',document):(ie4)?document.all['PBouter']:document.getElementById('PBouter'); PBdone=(ns4)?PBouter.document.layers['PBdone']:(ie4)?document.all['PBdone']:document.getElementById('PBdone'); resizeEl(PBdone,0,0,barheight-2,0); if(ns4)PBouter.visibility="show"; else PBouter.style.visibility="visible"; Pid=setInterval('incrCount()',95); //Load the rest of the pages, loading sequence system |