Error invoking Javascript function from .ascx file
<p>I migrated a VS 2003 app to VS 2010.
The application has side_menu.ascx which is referenced in default.aspx.
in side_menu.ascx, a javascript function <strong>menu</strong> is invoked which is present in side_menu.js.</p>

<p>However, when the function <strong>menu</strong> is invoked, it gives an error during runtime - <strong>'Cannot find funtion menu'</strong> This works fine in VS 2003</p>

<p>This is where I am getting this error - this code is in side_menu.ascx</p>

<pre><code> new menu (SIDE_MENU_ITEMS, SIDE_MENU_POS, SIDE_MENU_STYLES)
</code></pre>

<p>This is the code in default.aspx</p>

<pre><code>                    &lt;!-- Side Menu --&gt;
     &lt;td valign="top" class="page_side_menu"&gt;
        &lt;mycontrols:sidemenu id="SideMenu1" runat="server"/&gt;
        &lt;/td&gt;
</code></pre>

<p>This is the code in side_menu.ascx</p>

<pre><code>&lt;%@ Control Language="vb" AutoEventWireup="false" Codebehind="side_menu.ascx.vb" Inherits="TOrders.UI.Controls.SideMenu" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %&gt;
&lt;table cellPadding="0" width="100%"&gt;
&lt;tr&gt;
    &lt;td vAlign="top" align="left" width="100%"&gt;
        &lt;table cellSpacing="10" cellPadding="0" width="100%"&gt;
            &lt;tr&gt;
                &lt;td align="left"&gt;
                    &lt;asp:Literal ID="litError" Runat="server" Text="&lt;font color=#E0E0E0 size=1&gt;*&amp;nbsp;&lt;/font&gt;" Visible="False"&gt;&lt;/asp:Literal&gt;&lt;asp:label id="lblJump" runat="server" ForeColor="#E0E0E0" Font-Size="XX-Small"&gt;Jump to Telex/Order:&lt;/asp:label&gt;
                    &lt;br&gt;
                    &lt;asp:textbox id="txtJumpTo" runat="server" Width="125px" CssClass="textbox"&gt;&lt;/asp:textbox&gt;&amp;nbsp;&lt;input type="button" value="Go" runat="server" id="btnGo" class="TabOut-Button"&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;script language="JavaScript" src="~/library/scripts/side_menu.js"     type="text/javascript"&gt;&lt;/script&gt;
&lt;script language="JavaScript" src="~/library/scripts/side_menu_items.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script language="JavaScript" src="~/library/scripts/side_menu_tpl.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script language="JavaScript" type="text/javascript"&gt;
&lt;!--
new menu (SIDE_MENU_ITEMS, SIDE_MENU_POS, SIDE_MENU_STYLES);
// --&gt;
&lt;/script&gt;
</code></pre>

<p>This is the javascript function side_menu.js</p>

<pre><code>var menus = [];

function menu (item_struct, pos, styles) {
// browser check
this.item_struct = item_struct;
this.pos = pos;
this.styles = styles;
this.id = menus.length;
this.items = [];
this.children = [];

this.add_item = menu_add_item;
this.hide = menu_hide;

this.onclick = menu_onclick;
this.onmouseout = menu_onmouseout;
this.onmouseover = menu_onmouseover;
this.onmousedown = menu_onmousedown;

var i;
for (i = 0; i &lt; this.item_struct.length; i++)
    new menu_item(i, this, this);
for (i = 0; i &lt; this.children.length; i++)
    this.children[i].visibility(true);
menus[this.id] = this;
}
</code></pre>
