title: javascript functions in .ascx
body: <p>I've looked at about 5 Questions here on SOF and haven't really found a useful answer for this. How am I supposed to invoke my javascript functions from client-side events in my .ascx controls? Here is my .ascx file.. what most the answers have led me to:<br/></p>
  
  <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="UIMenu.ascx.cs" Inherits="controls_UIMenu" %&gt;
  
  &lt;script language="javascript" type="text/javascript"&gt;
      function insetItem(myMenu)
      {
          myMenu.setAttribute("class", "myClass");
      }
  &lt;/script&gt;
  
  &lt;asp:Menu ID="Menu1" runat="server" Font-Bold="True" Font-Size="Large" Height="50px"
    Orientation="Horizontal" Target="_self" StaticMenuItemStyle-HorizontalPadding="10px"
    OnMenuItemClick="insetItem(this)" StaticMenuItemStyle-BorderStyle="outset"&gt;
    &lt;Items&gt;
      &lt;asp:MenuItem NavigateUrl="~/Home.aspx" Target="_self" Text="Home" Value="Home"&gt;&lt;/asp:MenuItem&gt;
      &lt;asp:MenuItem NavigateUrl="~/Loaner.aspx" Target="_self" Text="New" Value="New"&gt;&lt;/asp:MenuItem&gt;
    &lt;/Items&gt;
  &lt;/asp:Menu&gt;
  </code></pre>
  
  <p>I'm getting different errors when doing it this way. ".....ascx does not contain a definition for "insetItem"", and my other pages that use this file don't recognize it anymore. When I try to put the js on the actual .aspx pages that will be using it, I get the same no definition error.<br/><br/>
  I just started learning jscript, still pretty noob. I'm trying to make it so when the user down clicks a menu item, I want that item's borderstyle to change to "inset". I'm not sure how to change that attribute for the specific item that gets clicked either in javascript >_&lt; but that's another question. If anyone could lead me the right way in doing this too, that'd be amazing. Thanks!</p>