|
||||||
| JavaScript and CSS Extensible Markup Language, Java Script, and CSS questions here. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hey, so basically I got this javascript that turns the current date into a mayan long count. I tied it to an xul file that pops up the date in firefox(it's a frefox extension). Everything works fine but the javascript code won't work. Here it is:
Code:
function LongCount()
{
var curDate = new Date();
var endCycle = new Date(2012,11,21);
var milsDay = 1000*60*60*24;
var diff = Math.ceil((endCycle.getTime() - curDate.getTime())/milsDay);
var LongCount = new Array();
LongCount[0] = 13;
LongCount[1] = 0;
LongCount[2] = 0;
LongCount[3] = 0;
LongCount[4] = 0;
var i = 0;
for (i = 1; i = diff; )
{
if (LongCount[4] - 1 < 0)
{
if (LongCount[3] - 1 < 0)
{
if (LongCount[2] - 1 < 0)
{
if (LongCount[1] - 1 < 0)
{
if (LongCount[0] - 1 < 0)
{
LongCount[0] = 20;
LongCount[1] = 0;
LongCount[2] = 0;
LongCount[3] = 0;
LongCount[4] = 0;
}
else
{
LongCount[1] = 20;
LongCount[0] -= 1;
}
}
else
{
LongCount[2] = 20;
LongCount[1] -= 1;
}
}
else
{
LongCount[3] = 20;
LongCount[2] -= 1;
}
}
else
{
LongCount[4] = 20;
LongCount[3] -= 1;
}
}
else
{
LongCount[4] -= 1;
}
}
return LongCount[0] + "." + LongCount[1] + "." + LongCount[2] + "." LongCount[3] + "." + LongCount[4];
}
Thanks in advance =] |
| Sponsored Links |
|
|
|
|||
|
Quote:
I just a while loop instead. =] thanks |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to add My program to Startup ? | kresh7 | Visual Basic Programming | 44 | 08-10-2008 11:10 AM |
| Java:Tutorial - Tic-Tac-Toe | John | Java Tutorials | 25 | 02-27-2008 06:41 PM |
| SecurityAudit | vinay | Visual Basic Programming | 27 | 01-07-2008 12:14 PM |
| buttons with effect | ikkeugh | Visual Basic Programming | 21 | 10-04-2007 10:24 AM |
| PHP:Tutorial The Date | John | PHP Tutorials | 0 | 01-10-2007 06:10 PM |
| John | ........ | 223.00000 |
| dargueta | ........ | 168.00000 |
| Xav | ........ | 164.00000 |
| gaylo565 | ........ | 18.00000 |
| WingedPanther | ........ | 15.00000 |
| |pH| | ........ | 15.00000 |
| Johnnyboy | ........ | 3.00000 |
| navghost | ........ | 1.00000 |
Goal: 100,000 Posts
Complete: 66%