I am having this problem when running the code contained in the following javascript function...
Didn't include the DateTimePrep function, however, I know it works because I tested it without the ClearInterval(Timer); code at the beginning of this function and it shows the text using innerHTML just fine. However, once I click a button to change the text and the function startText() is called yet again it doesn't clear the interval, so I decided I need the ClearInterval(Timer); statement. But when testing this function, it simply shows NO TEXT at all...??? It seems to be wiping out the interval altogether as if it never existed. Can anyone please help me?? Why is the ClearInterval(Timer); code in the beginning of this function making it so that it won't let me setInterval???
function startText(xType)
{
ClearInterval(Timer);
if (xType == "TimeDefault")
{
DateTimePrep('TimeDefault');
Timer = setInterval('DateTimePrep(\'TimeDefault\')', 1000);
}
if (xType == "TimeNoSec")
{
DateTimePrep('TimeNoSec');
Timer = setInterval('DateTimePrep(\'TimeNoSec\')', 1000);
}
if (xType == "TimeMilitary")
{
DateTimePrep('TimeMilitary');
Timer = setInterval('DateTimePrep(\'TimeMilitary\')', 1000);
}
if (xType == "TimeDate")
{
DateTimePrep('TimeDate');
Timer = setInterval('DateTimePrep(\'TimeDate\')', 1000);
}
if (xType == "DayWeek")
{
DateTimePrep('DayWeek');
Timer = setInterval('DateTimePrep(\'DayWeek\')', 1000);
}
if (xType == "CPURes")
{
SysResourcePrep('CPURes');
Timer = setInterval('SysResourcePrep(\'CPURes\')', 500);
}
if (xType == "MemRes")
{
SysResourcePrep('MemRes');
Timer = setInterval('SysResourcePrep(\'MemRes\')', 500);
}
}
Didn't include the DateTimePrep function, however, I know it works because I tested it without the ClearInterval(Timer); code at the beginning of this function and it shows the text using innerHTML just fine. However, once I click a button to change the text and the function startText() is called yet again it doesn't clear the interval, so I decided I need the ClearInterval(Timer); statement. But when testing this function, it simply shows NO TEXT at all...??? It seems to be wiping out the interval altogether as if it never existed. Can anyone please help me?? Why is the ClearInterval(Timer); code in the beginning of this function making it so that it won't let me setInterval???
function startText(xType)
{
ClearInterval(Timer);
if (xType == "TimeDefault")
{
DateTimePrep('TimeDefault');
Timer = setInterval('DateTimePrep(\'TimeDefault\')', 1000);
}
if (xType == "TimeNoSec")
{
DateTimePrep('TimeNoSec');
Timer = setInterval('DateTimePrep(\'TimeNoSec\')', 1000);
}
if (xType == "TimeMilitary")
{
DateTimePrep('TimeMilitary');
Timer = setInterval('DateTimePrep(\'TimeMilitary\')', 1000);
}
if (xType == "TimeDate")
{
DateTimePrep('TimeDate');
Timer = setInterval('DateTimePrep(\'TimeDate\')', 1000);
}
if (xType == "DayWeek")
{
DateTimePrep('DayWeek');
Timer = setInterval('DateTimePrep(\'DayWeek\')', 1000);
}
if (xType == "CPURes")
{
SysResourcePrep('CPURes');
Timer = setInterval('SysResourcePrep(\'CPURes\')', 500);
}
if (xType == "MemRes")
{
SysResourcePrep('MemRes');
Timer = setInterval('SysResourcePrep(\'MemRes\')', 500);
}
}