title: Calling javascript function when page loaded without onclick
body: <p>I have an footer.php file that have javascript code and functions. I use this footer.php file for all of my pages. When clicking buttons I use </p>
  
  <pre><code>onclick="MyFunc()"
  </code></pre>
  
  <p>but in some pages I need to call MyFunc without onclick, just when page loaded. I can not use "body onload" function because the  tag is in header.php file that all pages is using it. I have triend to put</p>
  
  <pre><code>&lt;script Language="JavaScript"&gt;
  window.onload=MyFunc; 
  &lt;/script&gt;
  </code></pre>
  
  <p>in my php file and </p>
  
  <pre><code>&lt;script Language="JavaScript"&gt;
  function MyFunc(){
  alert('hello');
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>in the footer.php but with no luck.</p>