// Every 10 seconds I want my index page to display a new title h4 with the id of //’current-an’ under ‘ann’ section from an external page.
//the code is correct but setAttribute(‘id’,’current-an’); doesn’t work unless I’m on //that external page. I want it to work when I’m on the index page. Thanks :)
window.onload = function() {
setInterval(“show()”, 10000);
}
function show(){
var y = document.getElementById(‘ann’).getElementsByTagName(‘h4’);
var ylen = y.length, index = 0;
y[0].setAttribute(‘id’,’current-an’);
setInterval(function() {
y[index].setAttribute(‘id’,’none’);
index = (index + 1) % ylen;
y[index].setAttribute(‘id’,’current-an’);
$(‘#show-announcements’).load(‘announcements.html #current-an’);
}, 2000);
}