<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" > <channel><title>Comments on: Calling JavaScript function from String</title> <atom:link href="http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html/feed" rel="self" type="application/rss+xml" /><link>http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html</link> <description>Tutorials, Java, J2EE, Struts, AJAX, JavaScript, CSS, Web 2.0, MySQL, Articles</description> <lastBuildDate>Wed, 08 Feb 2012 10:36:26 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Viral Patel</title><link>http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html/comment-page-1#comment-25453</link> <dc:creator>Viral Patel</dc:creator> <pubDate>Mon, 23 Jan 2012 18:46:23 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=571#comment-25453</guid> <description>Jerome, My bad :) I must agree I din&#039;t know about this method. Thank you so much for getting this to my attention. I&#039;ll update the tutorial right away and add this option as preferred solution.</description> <content:encoded><![CDATA[<p>Jerome, My bad <img src='http://viralpatel.net/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> I must agree I din&#8217;t know about this method. Thank you so much for getting this to my attention. I&#8217;ll update the tutorial right away and add this option as preferred solution.</p> ]]></content:encoded> </item> <item><title>By: jerome</title><link>http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html/comment-page-1#comment-25450</link> <dc:creator>jerome</dc:creator> <pubDate>Mon, 23 Jan 2012 17:28:16 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=571#comment-25450</guid> <description>Correct me if I&#039;m wrong, but this could also be a good solution, provided the only hint you&#039;ve got on the function to execute is its name : http://stackoverflow.com/questions/912596/how-to-turn-a-string-into-a-javascript-function-callI tried this with success : window[functionName](param);screw eval !! :D</description> <content:encoded><![CDATA[<p>Correct me if I&#8217;m wrong, but this could also be a good solution, provided the only hint you&#8217;ve got on the function to execute is its name :<br /> <a href="http://stackoverflow.com/questions/912596/how-to-turn-a-string-into-a-javascript-function-call" rel="nofollow">http://stackoverflow.com/questions/912596/how-to-turn-a-string-into-a-javascript-function-call</a></p><p>I tried this with success :<br /> window[functionName](param);</p><p>screw eval !! <img src='http://viralpatel.net/blogs/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: Viral Patel</title><link>http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html/comment-page-1#comment-23744</link> <dc:creator>Viral Patel</dc:creator> <pubDate>Tue, 10 Jan 2012 16:40:43 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=571#comment-23744</guid> <description>@Ssam - I agree with you. Using &lt;code&gt;eval&lt;/code&gt; is not advisable. But in the given situation &lt;code&gt;eval&lt;/code&gt; is only option, where one would like to call a function at runtime using just a name.</description> <content:encoded><![CDATA[<p>@Ssam &#8211; I agree with you. Using <code>eval</code> is not advisable. But in the given situation <code>eval</code> is only option, where one would like to call a function at runtime using just a name.</p> ]]></content:encoded> </item> <item><title>By: ssam</title><link>http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html/comment-page-1#comment-23740</link> <dc:creator>ssam</dc:creator> <pubDate>Tue, 10 Jan 2012 16:03:44 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=571#comment-23740</guid> <description>eval is bad, this is the worst way of executing a function.</description> <content:encoded><![CDATA[<p>eval is bad, this is the worst way of executing a function.</p> ]]></content:encoded> </item> <item><title>By: jey</title><link>http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html/comment-page-1#comment-18646</link> <dc:creator>jey</dc:creator> <pubDate>Wed, 14 Dec 2011 05:52:57 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=571#comment-18646</guid> <description>javascript eval() functionname0,name1,name3 are javascript variables. jline0,jline1,jline2 are javascript arraysstr=&quot;{name : name0,data : jline0},{name : name1,data : jline1},{name : name2,data : jline2			}&quot;; var ff=eval(str);document.ready( . .series :[ff] . . });I can&#039;t pass ff value  in series parameter. Please anyone help me. .</description> <content:encoded><![CDATA[<p>javascript eval() function</p><p>name0,name1,name3 are javascript variables.<br /> jline0,jline1,jline2 are javascript arrays</p><p>str=&#8221;{name : name0,data : jline0},{name : name1,data : jline1},{name : name2,data : jline2			}&#8221;;<br /> var ff=eval(str);</p><p>document.ready(<br /> .<br /> .</p><p>series :[ff]<br /> .<br /> .<br /> });</p><p>I can&#8217;t pass ff value  in series parameter. Please anyone help me. .</p> ]]></content:encoded> </item> <item><title>By: jonas</title><link>http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html/comment-page-1#comment-16540</link> <dc:creator>jonas</dc:creator> <pubDate>Tue, 04 Oct 2011 09:33:01 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=571#comment-16540</guid> <description>Great!! Been looking desperately for this functionality!!!</description> <content:encoded><![CDATA[<p>Great!! Been looking desperately for this functionality!!!</p> ]]></content:encoded> </item> <item><title>By: teal</title><link>http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html/comment-page-1#comment-16108</link> <dc:creator>teal</dc:creator> <pubDate>Mon, 26 Sep 2011 10:26:59 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=571#comment-16108</guid> <description>You should understand that using of &#039;eval&#039; is not good enough practice. Happily all js functions are stored in huge &#039;window&#039; object (if you use js inside browser, of course). So you can get direct pointer to your function by calling window[&#039;here_is_your_function_name_in_string&#039;]; Or you can even test if this function exists: window.hasOwnProperty(&#039;here_is_your_function_name_in_string&#039;);Ok, complete sample is: var s = &quot;my_function&quot;; if (window.hasOwnProperty(s)) window[s](params);</description> <content:encoded><![CDATA[<p>You should understand that using of &#8216;eval&#8217; is not good enough practice. Happily all js functions are stored in huge &#8216;window&#8217; object (if you use js inside browser, of course).<br /> So you can get direct pointer to your function by calling<br /> window['here_is_your_function_name_in_string'];<br /> Or you can even test if this function exists:<br /> window.hasOwnProperty(&#8216;here_is_your_function_name_in_string&#8217;);</p><p>Ok, complete sample is:<br /> var s = &#8220;my_function&#8221;;<br /> if (window.hasOwnProperty(s)) window[s](params);</p> ]]></content:encoded> </item> <item><title>By: anna</title><link>http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html/comment-page-1#comment-16107</link> <dc:creator>anna</dc:creator> <pubDate>Mon, 26 Sep 2011 07:57:07 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=571#comment-16107</guid> <description>thx=) help me a lot ;)</description> <content:encoded><![CDATA[<p>thx=) help me a lot <img src='http://viralpatel.net/blogs/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: GenysLt</title><link>http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html/comment-page-1#comment-13807</link> <dc:creator>GenysLt</dc:creator> <pubDate>Tue, 25 Jan 2011 23:28:38 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=571#comment-13807</guid> <description>Thank You</description> <content:encoded><![CDATA[<p>Thank You</p> ]]></content:encoded> </item> <item><title>By: Horoskop Skorpion</title><link>http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html/comment-page-1#comment-13064</link> <dc:creator>Horoskop Skorpion</dc:creator> <pubDate>Tue, 07 Sep 2010 00:35:29 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=571#comment-13064</guid> <description>Good info</description> <content:encoded><![CDATA[<p>Good info</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: viralpatel.net @ 2012-02-09 09:40:06 -->
