hey everyone,
so ive been going around the internet all day trying to help guide me in creating a div that rotates content every 4 seconds using ajax and ive decided a forum post might be the most effective at this point. my js script code below is obviously and the current problem im having is figuring out how to build the array to store the information of each of the hidden divs (class = "headline") .
[CODE=javascript]// Rotating headlines
function headlineRotate ( )
{
var HeadArray=new Array()
var numofHeads=docu ment.getElement sByTagName("div ");
var x = 0
for (var i=0; i<numofHeads; i++){
if (document.class Name=="headline "){
HeadArray.push( alldivs[i])
}
}
if (x<3){
x++;
}
else{
x=0;
}
document.getEle mentById('curre ntHeadline').in nerHTML = numofHeads[3].value;
}
function rotater() {
setInterval ( "headlineRotate ()", 4000);
}[/CODE]
so ive been going around the internet all day trying to help guide me in creating a div that rotates content every 4 seconds using ajax and ive decided a forum post might be the most effective at this point. my js script code below is obviously and the current problem im having is figuring out how to build the array to store the information of each of the hidden divs (class = "headline") .
[CODE=javascript]// Rotating headlines
function headlineRotate ( )
{
var HeadArray=new Array()
var numofHeads=docu ment.getElement sByTagName("div ");
var x = 0
for (var i=0; i<numofHeads; i++){
if (document.class Name=="headline "){
HeadArray.push( alldivs[i])
}
}
if (x<3){
x++;
}
else{
x=0;
}
document.getEle mentById('curre ntHeadline').in nerHTML = numofHeads[3].value;
}
function rotater() {
setInterval ( "headlineRotate ()", 4000);
}[/CODE]
Comment