View Full Version : method help??
adash5000
03-28-2003, 05:02 AM
some body just gave me a script recently. i know all but two methods. one method is getFracPart() and the other is setInterval().what is their main function in most scripts ,what does getFracPart() do??, what does setInterval() do???, and whats the difference between setInterval and setTimeout()
Spookster
03-28-2003, 05:37 AM
setTimeout() executes what you specify after a specified time elapses
setInterval() executes what you specify after a specified time elapses and then keeps repeating.
getFracPart() sounds like a user-defined function and without seeing what is in it I cannot tell you what it does.
HairyTeeth
03-28-2003, 06:33 AM
getFracPart(floatNum) is a user-defined function. Its a function that returns the fractional part (i.e. all numbers to the right of a decimal point in a floating point number) to the countdown() function. See glenngv's original script (http://www.codingforums.com/showthread.php?s=&threadid=17179)
The fraction returned from the getFracPart() function to the countdown() function is used to determine the number of hours, minutes and seconds that are left in a day, an hour or a minute respectively.
For example, the floating point number for the number of "days" left until the countdown is complete is 82.32260532407407 (on my computer anyway).
That number is passed from the "countdown()" function to the getFracPart(floatNum) function which returns all the numbers to the right of the decimal place (0.32260532407407) back to the "countdown()" function.
That number is the fractional equivlent of a part of a day. If you multiply that number by 24 (the number of hours in a day), you get the number of "hours left in that day" (which in my case, after rounding down, is 0.32260532407407 * 24 = 7 hours). This is what another part of the countdown() function does.
The process is repeated for minutes and seconds so that you get the right amount of minutes and seconds for any given part of the hour or minute.
It's a bit tricky. glenngv can no doubt better explain it. Hope it helped. Cheers
glenngv
03-28-2003, 07:26 AM
Thanks HairyTeeth! You explained it well :thumbsup:
adash5000
03-28-2003, 03:56 PM
thanks hairyteeth that helped me alot
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.