<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Client Side Web Development</title><link>http://forums.asp.net/130.aspx</link><description>Client-side programming discussions, including CSS, DHTML, JScript/Javascript, etc. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=18&amp;c=16" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Call JavaScript function based on (string) variable value - how?</title><link>http://forums.asp.net/thread/2477339.aspx</link><pubDate>Wed, 09 Jul 2008 13:32:29 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2477339</guid><dc:creator>BlackCatBone</dc:creator><author>BlackCatBone</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2477339.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2477339</wfw:commentRss><description>&lt;p&gt;This is my solution.&amp;nbsp; The code fragment shows how the eval function was used to form&amp;nbsp;a function call.&amp;nbsp; The code checks for the existence of the js function before calling it.&amp;nbsp; It also passes two string parameter values.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;targetPageScript = the name of the JavaScript in the external library 
&lt;p&gt;parm1 = the value of the 1st string parameter 
&lt;p&gt;parm2 = the value of the&amp;nbsp;2nd string parameter&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="coloredcode"&gt;            if (eval(&amp;#39;typeof(&amp;#39; + targetPageScript + &amp;#39;)&amp;#39;) == &amp;#39;function&amp;#39;)
            {
                eval(targetPageScript + &amp;#39;(&amp;quot;&amp;#39; + parm1  + &amp;#39;&amp;quot;, &amp;quot;&amp;#39; + parm2 + &amp;#39;&amp;quot;);&amp;#39;);
            }
            else
            {
   	        alert(&amp;#39;JavaScript function &amp;quot;&amp;#39; + targetPageScript + &amp;#39;&amp;quot; could not be found.  No attempt was made to call the function.&amp;#39;);
            }
&lt;/pre&gt;&amp;nbsp;&lt;font size="2"&gt;&lt;/font&gt;</description></item><item><title>Re: Call JavaScript function based on (string) variable value - how?</title><link>http://forums.asp.net/thread/2477190.aspx</link><pubDate>Wed, 09 Jul 2008 12:39:51 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2477190</guid><dc:creator>BlackCatBone</dc:creator><author>BlackCatBone</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2477190.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2477190</wfw:commentRss><description>&lt;p&gt;Thanks for the replies.&amp;nbsp; I agree that I did not explain my situation well.&amp;nbsp; I&amp;#39;ll try to do better.&amp;nbsp; Here goes:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;We have external libraries of JavaScript functions.&amp;nbsp; We have an aspx page (page &amp;quot;A&amp;quot;) that contains a generalized JavaScript function that calls another JavaScript in one our several external JavaScript libraries.&amp;nbsp; Here&amp;#39;s the twist:&amp;nbsp; The name of the JavaScript function to be called is passed as a string variable to the JavaScript function on page &amp;quot;A&amp;quot;.&amp;nbsp; I don&amp;#39;t know how to generate a valid function call to an external library starting with a variable that holds the function name.&lt;/p&gt;
&lt;p&gt;This is a simplified version on the JavaScript on page &amp;quot;A&amp;quot;.&lt;/p&gt;
&lt;p&gt;function CallExternal(functionName)&lt;br /&gt;{&lt;br /&gt;// here I need to call the function named in the functionName parameter.&amp;nbsp; functionName is a string.&lt;br /&gt;}&lt;br /&gt;
&lt;p&gt;I need to replace the comment in the function with the correct syntax. 
&lt;p&gt;Thanks!&lt;/p&gt;</description></item><item><title>Re: Call JavaScript function based on (string) variable value - how?</title><link>http://forums.asp.net/thread/2475807.aspx</link><pubDate>Tue, 08 Jul 2008 23:14:03 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2475807</guid><dc:creator>bubblesnout</dc:creator><author>bubblesnout</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2475807.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2475807</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Try and explain your situation a little better. Probably with an examle of the code you are using. If you need to reference a function in an external library, always put your Javascript library references first; before your own javascript. That way you can be sure that the functions are accessible. If you for some reason can&amp;#39;t do this, usually you can just add the function to your window.onload. eg.&lt;/p&gt;&lt;p&gt;window.onload = function(){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A();&lt;br /&gt;}; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Call JavaScript function based on (string) variable value - how?</title><link>http://forums.asp.net/thread/2475769.aspx</link><pubDate>Tue, 08 Jul 2008 22:15:08 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2475769</guid><dc:creator>AceCorban</dc:creator><author>AceCorban</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2475769.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2475769</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;pre class="coloredcode"&gt;&lt;span class="cmt"&gt;//--------other library&lt;/span&gt;
function B()
{
    &lt;span class="cmt"&gt;//do stuff&lt;/span&gt;
}
&lt;span class="cmt"&gt;//--------end other library&lt;/span&gt;

function A()
{
     &lt;span class="cmt"&gt;//do stuff&lt;/span&gt;
     B();
}&lt;/pre&gt;&amp;nbsp;The only reason I can forsee why you might get an error is if the other library isn&amp;#39;t loaded first.&amp;nbsp; Function A will complain that it can&amp;#39;t find Function B if it is declared after function A is called.</description></item><item><title>Call JavaScript function named in a string variable - how?</title><link>http://forums.asp.net/thread/2475706.aspx</link><pubDate>Tue, 08 Jul 2008 21:26:39 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2475706</guid><dc:creator>BlackCatBone</dc:creator><author>BlackCatBone</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2475706.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2475706</wfw:commentRss><description>&lt;p&gt;Greetings,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I need to call JavaScript function &amp;quot;B&amp;quot; based on&amp;nbsp;a string value passed to&amp;nbsp;JavaScript function &amp;quot;A&amp;quot;.&amp;nbsp; JavaScript function &amp;quot;B&amp;quot; resides in an external library and is not present on the page where function &amp;quot;A&amp;quot; exists.&amp;nbsp; What is the syntax to do this?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;BCB&lt;/p&gt;</description></item></channel></rss>