|
Rank: Advanced Member Groups: Member
Joined: 7/3/2009 Posts: 37
|
I'm dynamically trying to add an extra tab to the red tab menu example, my code successfully inserts a new menu with a submenu but when I hover with the mouse over to new tab it gives me a jscript error: object expected...
<script type="text/javascript"> //The current selected top level item var g_curSelectedItem = null;
function on_menu_hover(e, info) { var item = info.getItem(); if (g_curSelectedItem == item) return; if (g_curSelectedItem) { //Unselect current selected item g_curSelectedItem.setSelected(false); //Hide child menu document.getElementById(g_curSelectedItem.getValue()).style.display = "none"; } else document.getElementById("divHome").style.display = "none"; if (item) { //Select the new item item.setSelected(true); //Show new child emnu document.getElementById(item.getValue()).style.display = "block"; } g_curSelectedItem = item; } </script>
Below is the code I'm using and it works...any ideas? Menu1.Items.Add("NewTab"); Menu1.ClientSideOnItemMouseOver="on_menu_hover"; Menu1.Items[3].SubMenu.Items.Add("NewTabSubmenu");
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
I believe that's because when you add a new item, you didn't set the new item's Value property. However your client side code uses this property:
document.getElementById(g_curSelectedItem.getValue()).style.display = "none";
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 7/3/2009 Posts: 37
|
How would I add a value, please give me any example. thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You will need to do something like this:
EO.Web.MenuItem newItem = Menu1.Items[3].SubMenu.Items.Add("NewTabSubmenu"); newItem.Value = "whatever";
You also need to understand why you need to set this property and what this value is used for. So you will need to understand the client side JavaScript code first. If you are not familiar with JavaScript, you may want to find someone who can explain those code to you.
Thanks
|
|