How to run an array of function inside an array variable
<p>I'm trying to run series of functions i placed on a variable. </p>

<p>Here's a (<strong><a href="http://jsfiddle.net/fGaHR/5/" rel="nofollow">demo</a></strong>)</p>

<p><strong>Code:</strong></p>

<pre><code>function pass_me(x) {
    alert(x);        
};

var colors = new Array();
var colors = ["pass_me('yellow');", "pass_me('green');", "pass_me('blue');"]

for(var i = 0; i &lt;= colors.length; i++) {
    window[colors[i]]();
}​
</code></pre>

<p>unfortunately, I can't make it run. Any idea what's wrong in my code?</p>

<p>Thanks</p>

<hr>

<p>The story behind the array variable of function, is because i copied it from a dynamic element. This way it will only run what function is already in the page. So if pass_me("red") is not present, it will not be run.</p>

<p>Example:</p>

<pre><code>&lt;img src="img/something.jpg" ondblclick="pass_me("yellow")" /&gt;
&lt;img src="img/something.jpg" ondblclick="pass_me("green")" /&gt;
&lt;img src="img/something.jpg" ondblclick="pass_me("blue")" /&gt;
</code></pre>

<p>then I just use:</p>

<pre><code>jQuery("td img").each(function(){
colors.push(jQuery(this).attr("ondblclick"));
})
</code></pre>
