IPfreely
01-07-2004, 02:24 PM
hey guys!
this looks like a cool forum! ok, i wrote a little script that will flip through random quotes and display them in a table every few seconds. problem is the first time the page is loaded it give an error. also, when i refresh the page, the code gives an error.
here is the code:var CurrentMsg;//-> had original message in here
function update(msg)
{
CurrentMsg = msg;
document.getElementById("customerQuote").innerHTML=CurrentMsg;
clearTimeout(timer);
timer = setTimeout("idleMsg()",6500);
}
function update2(msg)
{
CurrentMsg = msg;
document.getElementById("custName").innerHTML=CurrentMsg;
clearTimeout(timer);
timer = setTimeout("idleMsg()",6500);
}
var notice_num = 4; // -> change this to length of array
var notices = new Array();
notices[1] = 'We\'ve used Superior Snow Remov...excellent.';
notices[2] = '"I need my shopping center cleared ..."';
notices[3] = '"We\'ve used Superior for 4 years now and they\'re an excellent service. ...."';
notices[4] = '"Superior does an excellent job handling ..."';
var customers = new Array();
customers[1] = "Alvin Trumbone<br> Aldi Inc. <br> #54, 46th & Market Philadelphia, PA.";
customers[2] = "Frank Ullman<br> Brentway Management LLC ";
customers[3] = "Barbara Corvo<br> Dion-Segal Associates";
customers[4] = "Barbara Claffie<br> Stein Investment Group";
var timer = setTimeout('idleMsg()',0); // time before first message appears
function idleMsg()
{
index = 1 + Math.round((notice_num * Math.random()));
if(index>notice_num)
{
index=notice_num;
}
if(index<1)
{
index=1;
}
update(notices[index]);
update2(customers[index]);
}
any ideas why this is buggy?? I've been testing in IE 6 on winXP
thanks for reading this post,
IPfreely
this looks like a cool forum! ok, i wrote a little script that will flip through random quotes and display them in a table every few seconds. problem is the first time the page is loaded it give an error. also, when i refresh the page, the code gives an error.
here is the code:var CurrentMsg;//-> had original message in here
function update(msg)
{
CurrentMsg = msg;
document.getElementById("customerQuote").innerHTML=CurrentMsg;
clearTimeout(timer);
timer = setTimeout("idleMsg()",6500);
}
function update2(msg)
{
CurrentMsg = msg;
document.getElementById("custName").innerHTML=CurrentMsg;
clearTimeout(timer);
timer = setTimeout("idleMsg()",6500);
}
var notice_num = 4; // -> change this to length of array
var notices = new Array();
notices[1] = 'We\'ve used Superior Snow Remov...excellent.';
notices[2] = '"I need my shopping center cleared ..."';
notices[3] = '"We\'ve used Superior for 4 years now and they\'re an excellent service. ...."';
notices[4] = '"Superior does an excellent job handling ..."';
var customers = new Array();
customers[1] = "Alvin Trumbone<br> Aldi Inc. <br> #54, 46th & Market Philadelphia, PA.";
customers[2] = "Frank Ullman<br> Brentway Management LLC ";
customers[3] = "Barbara Corvo<br> Dion-Segal Associates";
customers[4] = "Barbara Claffie<br> Stein Investment Group";
var timer = setTimeout('idleMsg()',0); // time before first message appears
function idleMsg()
{
index = 1 + Math.round((notice_num * Math.random()));
if(index>notice_num)
{
index=notice_num;
}
if(index<1)
{
index=1;
}
update(notices[index]);
update2(customers[index]);
}
any ideas why this is buggy?? I've been testing in IE 6 on winXP
thanks for reading this post,
IPfreely