Is there anything wrong in my javascript?
<p>I wrote this javascript to make an animation. It is working fine in the home page. I wrote a alert message in the last.</p>

<p>If I go other then home page, this alert message has to come, but I am getting alert message, if I remove the function, alert message working on all pages, any thing wrong in my code?</p>

<pre><code>window.onload = function(){

    var yellows = document.getElementById('magazine-brief').getElementsByTagName('h2');
    var signUp = document.getElementById('signup-link');

        if (yellows != 'undefined' &amp;&amp; signUp != undefined){
            function animeYellowBar(num){
                setTimeout(function(){
                    yellows[num].style.left = "0";
                    if(num == yellows.length-1){
                        setTimeout(function(){
                            signUp.style.webkitTransform = "scale(1)";
                        },num*250);
                    }

                }, num * 500);
            }
            for (var i = 0; i &lt; yellows.length; i++){
                animeYellowBar(i);
            }
        }

    alert('hi');

}
</code></pre>
