Javascript convert string into function name
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/496961/call-a-javascript-function-name-using-a-string">Call a JavaScript function name using a string?</a><br>
  <a href="http://stackoverflow.com/questions/4639837/javascript-string-to-variable">javascript string to variable</a>  </p>
</blockquote>



<p>I have this code:</p>

<pre><code>var Functionify = function() {

    return {

        init: function(el, t) {
            var els = document.getElementsByClassName(el);
            var elsL = els.length;

            while(elsL--){
                //els[elsL].onclick = els[elsL].getAttribute(t);
                els[elsL].addEventListener('click', els[elsL].getAttribute(t), false);
            }
        }

    };

}();
</code></pre>

<p>Where <code>el = 'myClassName'</code> and <code>t = 'data-id'</code></p>

<p>Now, 't' is a string, how can tell the addEventListener function to use 't' (a string) as a function name?</p>
