Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Hi, I’m trying to have every 10 seconds my index page to display a new title h4 frm external page

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #33474
    sue2kittie
    Member

    // 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);

    }

Viewing 1 post (of 1 total)
  • The forum ‘CSS’ is closed to new topics and replies.