Keep a Main Menu item highlighted when visiting a page

Top  Previous  Next

You can keep a Main Menu item highlighted when visiting a web page by using the following code inside your page:

 

<script>awmSelectedItem=x</script>

 

where x is the order of the Main Menu item you wish to be shown as selected.

 

By doing so, the selected item will be displayed with its [Mouse Click] state instead of its [Normal] state.

 

 

Example:

Let's assume you have the following menu and you want the "Downloads" item to be highlighted when you visit the downloads.html page:

clip0005

 

 

Since the "Downloads" item is the 2nd item in the Main Menu, you just need to put the following code before the menu-linking code inside your downloads.html page:

 

<script>awmSelectedItem=2</script>

 

When you now visit the downloads.html page, all Main Menu items will be displayed at their [Normal] state except of the "Downloads" item which will be displayed at its [Mouse Click] state.

 

 

Notes:

- This feature applies only for the Main Menu items. You cannot use this feature to have a submenu item highlighted.

 

- The [Mouse Over] state will be displayed instead of the [Mouse Click] state if you have the "Ignore [Mouse Click] values" box checked inside the Tools -> Project Properties -> Optimization tab.

 

 


Special note for multiple menus only:

If you have more than one menu in the same page, then you need to use the <script>awmSelectedItem=x</script> right before the menu-linking section of all menus:

 

where, 

x = the number of the selected item for the menu you want to have the highlighted option and

x = 0 for the rest of the menus.

 

Example of highlighting the 2nd item of menu2.js only:

 

<script>awmSelectedItem=0</script>

<!-- DO NOT MOVE! The following AllWebMenus code must always be placed right AFTER the BODY tag-->

<!-- ******** BEGIN ALLWEBMENUS CODE FOR menu1 ******** -->

<script type="text/javascript">var MenuLinkedBy="AllWebMenus [4]",awmMenuName="menu",awmBN="628";awmAltUrl="";</script>

<script charset="UTF-8" src="menu1.js" type="text/javascript"></script><script type="text/javascript">awmBuildMenu();</script>

<!-- ******** END ALLWEBMENUS CODE FOR menu1 ******** -->

 

<script>awmSelectedItem=2</script>

<!-- DO NOT MOVE! The following AllWebMenus code must always be placed right AFTER the BODY tag-->

<!-- ******** BEGIN ALLWEBMENUS CODE FOR menu2 ******** -->

<script type="text/javascript">var MenuLinkedBy="AllWebMenus [4]",awmMenuName="menu",awmBN="628";awmAltUrl="";</script>

<script charset="UTF-8" src="menu2.js" type="text/javascript"></script><script type="text/javascript">awmBuildMenu();</script>

<!-- ******** END ALLWEBMENUS CODE FOR menu2 ******** -->

 

<script>awmSelectedItem=0</script>

<!-- DO NOT MOVE! The following AllWebMenus code must always be placed right AFTER the BODY tag-->

<!-- ******** BEGIN ALLWEBMENUS CODE FOR menu3 ******** -->

<script type="text/javascript">var MenuLinkedBy="AllWebMenus [4]",awmMenuName="menu",awmBN="628";awmAltUrl="";</script>

<script charset="UTF-8" src="menu3.js" type="text/javascript"></script><script type="text/javascript">awmBuildMenu();</script>

<!-- ******** END ALLWEBMENUS CODE FOR menu3 ******** -->

 

 

 



DHTML menu builder
CSS menu builder
CSS menu builder
Joomla menu builder
Joomla menu builder
WordPress menu builder
WordPress menu builder
Keep a Main Menu item highlighted when visiting a page
Javascript menu software
How Do I,How Do I Keep a Main Menu item highlighted when visiting a page
Drop-down menu maker
Drop-down menu maker