kyberspace
07-03-2003, 11:21 AM
I have written a javascript which loads a series of text messages into an iframe on the page.
The problem I'm having is that each time a message loads, it reloads the entire page. So the "back" menu on the user's browser quickly fills up with the same page, over and over.
How can I make it so that loading the message into the iframe does not load the entire page?
The code follows:
//ROTATING MESSAGES
var timerID_1 = null;
var timerID_2 = null;
var no_of_Messages = 11;
var bIsPaused = false
var sHead = "<font style='font-weight:bold; color:red;'>TOP 10 ISSUES</font>"
//The arrays of the messages, pages, widths and heights
var msgArray = new Array(no_of_Messages);
var arrPage = new Array(no_of_Messages);
var arrWidth = new Array(no_of_Messages);
var arrHeight = new Array(no_of_Messages);
msgArray[1] = "<font style='font-weight:bold;color:red;'>IN THE COMMUNITY<br> FOR 2003</font>"
arrPage[1] ='Top10.htm'
arrWidth[1] =650
arrHeight[1] =550
msgArray[2] = "<b>1.</b> Recession and its aftermath in Virginia"
arrPage[2] ='No1.htm'
arrWidth[2] =300
arrHeight[2] =120
msgArray[3] = "<b>2.</b> Local and state government revenues and services"
arrPage[3] ='No2.htm'
arrWidth[3] =300
arrHeight[3] =120
msgArray[4] = "<b>3.</b> Growth of immigrant/minority groups in Richmond and Virginia"
arrPage[4] ='No3.htm'
arrWidth[4] =300
arrHeight[4] =120
msgArray[5] = "<b>4.</b> Virginia's contribution to the war effort"
arrPage[5] ='No4.htm'
arrWidth[5] =300
arrHeight[5] =120
msgArray[6] = "<b>5.</b> Richmond downtown development"
arrPage[6] ='No5.htm'
arrWidth[6] =300
arrHeight[6] =120
msgArray[7] = "<b>6.</b> Virginia's homeland security response and problems"
arrPage[7] ='No6.htm'
arrWidth[7] =300
arrHeight[7] =120
msgArray[8] = "<b>7.</b> Race relations in metro Richmond and in Virginia "
arrPage[8] ='No7.htm'
arrWidth[8] =300
arrHeight[8] =120
msgArray[9] = "<b>8.</b> Aging population "
arrPage[9] ='No8.htm'
arrWidth[9] =300
arrHeight[9] =120
msgArray[10] = "<b>9.</b> Technology is changing our society"
arrPage[10] ='No9.htm'
arrWidth[10] = 300
arrHeight[10] =120
msgArray[11] = "<b>10.</b> Regional cooperation in Metro Richmond"
arrPage[11] ='No10.htm'
arrWidth[11] =300
arrHeight[11] =120
//change this to increase or decrease viewing time per Message
var viewing_time=3000;//in milliseconds [ thousandths of seconds ]
//Show the messages. You can change any of this (for example: the background and type color, the size of the pop up window)
function showMessage() {
timerID_2=setTimeout('changeMessage()',viewing_time);
slide.document.clear();
var w = arrWidth[current_Message];
var h = arrHeight[current_Message];
var page = arrPage[current_Message];
var message = msgArray[current_Message];
slide.document.write("<style>a{ text-decoration:none; color:#000080; font:normal 8pt Arial } a:hover{ color:purple }</style><body><div id='slideDiv' style='width:140px; height:70px; filter:progid:DXImageTransform.Microsoft.Fade(duration=1.0,overlap=1.0);background-color:white; color:#000080; font:normal 8pt Arial;'><a href='" + page + "' onclick='window.open(this.href,\"name\",\"width=" + w + ", height=" + h + ", top=\" + (screen.height-" + h + ") /4 + \",left=\" + (screen.width-" + w + ")/4 + \",scrollbars=yes, resizable\"); return false'>" + sHead + "<br>" + message + "</div></body>")
var slideDiv = slide.document.getElementById("slideDiv")
slideDiv.filters(0).Apply();
slideDiv.filters(0).Play();
slide.document.close();
}
function changeMessage() {
var timerID_1=setTimeout('showMessage()',1);
if(current_Message >= no_of_Messages ) {
current_Message = 0;}
current_Message++;
}
function pauseMessage(){
clearTimeout(timerID_1);
clearTimeout(timerID_2);
}
//This is the function that goes in the onLoad event in the body tag of your page
function startCycling(){
current_Message=0;
changeMessage();
}
//END OF ROTATING MESSAGE CODE
The problem I'm having is that each time a message loads, it reloads the entire page. So the "back" menu on the user's browser quickly fills up with the same page, over and over.
How can I make it so that loading the message into the iframe does not load the entire page?
The code follows:
//ROTATING MESSAGES
var timerID_1 = null;
var timerID_2 = null;
var no_of_Messages = 11;
var bIsPaused = false
var sHead = "<font style='font-weight:bold; color:red;'>TOP 10 ISSUES</font>"
//The arrays of the messages, pages, widths and heights
var msgArray = new Array(no_of_Messages);
var arrPage = new Array(no_of_Messages);
var arrWidth = new Array(no_of_Messages);
var arrHeight = new Array(no_of_Messages);
msgArray[1] = "<font style='font-weight:bold;color:red;'>IN THE COMMUNITY<br> FOR 2003</font>"
arrPage[1] ='Top10.htm'
arrWidth[1] =650
arrHeight[1] =550
msgArray[2] = "<b>1.</b> Recession and its aftermath in Virginia"
arrPage[2] ='No1.htm'
arrWidth[2] =300
arrHeight[2] =120
msgArray[3] = "<b>2.</b> Local and state government revenues and services"
arrPage[3] ='No2.htm'
arrWidth[3] =300
arrHeight[3] =120
msgArray[4] = "<b>3.</b> Growth of immigrant/minority groups in Richmond and Virginia"
arrPage[4] ='No3.htm'
arrWidth[4] =300
arrHeight[4] =120
msgArray[5] = "<b>4.</b> Virginia's contribution to the war effort"
arrPage[5] ='No4.htm'
arrWidth[5] =300
arrHeight[5] =120
msgArray[6] = "<b>5.</b> Richmond downtown development"
arrPage[6] ='No5.htm'
arrWidth[6] =300
arrHeight[6] =120
msgArray[7] = "<b>6.</b> Virginia's homeland security response and problems"
arrPage[7] ='No6.htm'
arrWidth[7] =300
arrHeight[7] =120
msgArray[8] = "<b>7.</b> Race relations in metro Richmond and in Virginia "
arrPage[8] ='No7.htm'
arrWidth[8] =300
arrHeight[8] =120
msgArray[9] = "<b>8.</b> Aging population "
arrPage[9] ='No8.htm'
arrWidth[9] =300
arrHeight[9] =120
msgArray[10] = "<b>9.</b> Technology is changing our society"
arrPage[10] ='No9.htm'
arrWidth[10] = 300
arrHeight[10] =120
msgArray[11] = "<b>10.</b> Regional cooperation in Metro Richmond"
arrPage[11] ='No10.htm'
arrWidth[11] =300
arrHeight[11] =120
//change this to increase or decrease viewing time per Message
var viewing_time=3000;//in milliseconds [ thousandths of seconds ]
//Show the messages. You can change any of this (for example: the background and type color, the size of the pop up window)
function showMessage() {
timerID_2=setTimeout('changeMessage()',viewing_time);
slide.document.clear();
var w = arrWidth[current_Message];
var h = arrHeight[current_Message];
var page = arrPage[current_Message];
var message = msgArray[current_Message];
slide.document.write("<style>a{ text-decoration:none; color:#000080; font:normal 8pt Arial } a:hover{ color:purple }</style><body><div id='slideDiv' style='width:140px; height:70px; filter:progid:DXImageTransform.Microsoft.Fade(duration=1.0,overlap=1.0);background-color:white; color:#000080; font:normal 8pt Arial;'><a href='" + page + "' onclick='window.open(this.href,\"name\",\"width=" + w + ", height=" + h + ", top=\" + (screen.height-" + h + ") /4 + \",left=\" + (screen.width-" + w + ")/4 + \",scrollbars=yes, resizable\"); return false'>" + sHead + "<br>" + message + "</div></body>")
var slideDiv = slide.document.getElementById("slideDiv")
slideDiv.filters(0).Apply();
slideDiv.filters(0).Play();
slide.document.close();
}
function changeMessage() {
var timerID_1=setTimeout('showMessage()',1);
if(current_Message >= no_of_Messages ) {
current_Message = 0;}
current_Message++;
}
function pauseMessage(){
clearTimeout(timerID_1);
clearTimeout(timerID_2);
}
//This is the function that goes in the onLoad event in the body tag of your page
function startCycling(){
current_Message=0;
changeMessage();
}
//END OF ROTATING MESSAGE CODE