• hello
    im trying to add this javascript code to my header but its not working
    im using graviti theme

    var rotatingTextElement;
    var rotatingText = new Array();
    var ctr = 0;
    
    function initRotateText() {
    rotatingTextElement = document.getElementById("textToChange");
    rotatingText[0] = rotatingTextElement.innerHTML; // store the content that's already on the page
    rotatingText[1] = "<a href='<?php echo $long_link; ?>'>some words</a>";
    
    setInterval(rotateText, 10000);
    }
    function rotateText() {
    ctr++;
    if(ctr >= rotatingText.length) {
    ctr = 1;
    }
    rotatingTextElement.innerHTML = rotatingText[ctr];
    }
    window.onload = initRotateText;

    can i have some help?
    thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘problem using some javascript codes in header’ is closed to new replies.