Title: problem using some javascript codes in header
Last modified: August 21, 2016

---

# problem using some javascript codes in header

 *  [egyzaman](https://wordpress.org/support/users/egyzaman/)
 * (@egyzaman)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/problem-using-some-javascript-codes-in-header/)
 * 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)

 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/problem-using-some-javascript-codes-in-header/#post-4965947)
 * Please review this Codex article:
 * [http://codex.wordpress.org/Using_Javascript](http://codex.wordpress.org/Using_Javascript)
 *  Thread Starter [egyzaman](https://wordpress.org/support/users/egyzaman/)
 * (@egyzaman)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/problem-using-some-javascript-codes-in-header/#post-4966000)
 * i already did i even read from outside sites but it just not loaded i dont know
   why
    more help plz
 * _[ No bumping please_

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

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

## Tags

 * [Codes](https://wordpress.org/support/topic-tag/codes/)
 * [header](https://wordpress.org/support/topic-tag/header/)
 * [in](https://wordpress.org/support/topic-tag/in/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [problem](https://wordpress.org/support/topic-tag/problem/)
 * [using](https://wordpress.org/support/topic-tag/using/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [egyzaman](https://wordpress.org/support/users/egyzaman/)
 * Last activity: [11 years, 12 months ago](https://wordpress.org/support/topic/problem-using-some-javascript-codes-in-header/#post-4966000)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
