call a function using window[variablename](); in document.ready
<p>I have functions in side a <strong>document.ready</strong> and i want to call them using value inside a variable.. I tried to use <code>window[variablename]();</code> but it is not working inside <strong>document.ready</strong> but when called it directly it works..</p>

<p>think this is the function inside the document.ready</p>

<pre><code>$(document).ready(function() {

    function jhon(){
         alert('works');
    };
});
</code></pre>

<p>Im getting function name from a variable,value of that variable is the name of the function..</p>

<p>below code will get the URL's hashed part example: #JHON and remove # and store it inside URLHASH variable..example: JHON</p>

<pre><code>  var urlhash = document.location.hash;
  urlhash = urlhash.replace(/^.*#/, '');
</code></pre>

<p>when i called like this it is not working..</p>

<pre><code>  window.onload=function() {
      window[urlhash]();
  };
</code></pre>

<p>but when I call the function like this it is working fine..</p>

<pre><code>  window.onload=function() {
      jhon();
  };
</code></pre>

<p>Is it possible to call a funtion using variable value? help me...</p>
