Hi world,
I have this menu
<
asp:Menu ID="MenuMain" runat="server" BackColor="#F7F6F3"
DynamicHorizontalOffset="2"
Font-Names="Verdana" Font-Size="0.8em" ForeColor="#7C6F57"
StaticSubMenuIndent="10px" Orientation ="Horizontal" OnMenuItemClick="MenuMain_MenuItemClick" >
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DynamicMenuStyle BackColor="#F7F6F3" />
<StaticSelectedStyle BackColor="#5D7B9D" ForeColor="White" />
<DynamicSelectedStyle BackColor="#5D7B9D" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
<Items>
<asp:MenuItem Text="Change User" Value="ChangeUser" ></asp:MenuItem>
<asp:MenuItem Text="User Manual" Value="UserManual" NavigateUrl="~/Documents/FastTrackReadme.pdf" ></asp:MenuItem>
<asp:MenuItem Text="Links" Selectable="False" Value="Links">
<asp:MenuItem Text="WAWF" NavigateUrl="http://wawf.eb.mil" Value="WAWF"></asp:MenuItem>
<asp:MenuItem Text="AFCEE Web" NavigateUrl="http://www.afcee.brooks.af.mil" Value="AFCEE Web"></asp:MenuItem>
<asp:MenuItem Text="Outlook" Value="Outlook"></asp:MenuItem>
</asp:MenuItem>
</Items>
</asp:Menu>
And I want to add JavaScript in the "ChangeUser" Item (the first item), so when users click on this page, it won't post back to the server and it will execute my function.
Example:
<asp:MenuItem Text="Change User" Value="ChangeUser" onclick="MyFunction();"></asp:MenuItem>
But it won't let me add the onclick attribute, nor do something like:
MenuMain.items[0].Attributes.Add("onclick", "myfunction();");
Any ideas how I can attach my function to this menu item?
Thanks world.
--
Ask and it will be given to you; seek and you will find; knock and the door will be opened to you. Luke 11:9