onload function issue
<p>I use this javascript on the home page, and that page contain h2 tags within an element magazine-brief, the alert is working well. If I go to any other page which does not have an element magazine-brief the alert box does not work. How can i solve this problem. my code is :</p>

<pre><code>window.onload = function(){
    var yellows = document.getElementById('magazine-brief').getElementsByTagName('h2');
    alert('hi');
}
</code></pre>
