开发者

MENU item selected

开发者 https://www.devze.com 2023-02-23 01:11 出处:网络
I have a menu created in ASP.NET master page. I have implemented CSS properties to menu items like hover and link, but I am not able to implement the properties for changing the color of the selected

I have a menu created in ASP.NET master page. I have implemented CSS properties to menu items like hover and link, but I am not able to implement the properties for changing the color of the selected item in 开发者_高级运维the menu.

Do I need to write any JavaScript or jQuery code for identifying the selected item in the menu? Please help me, as I am new to this type of menu items.


if you mean that you want to change the color of a menu item persistently (like, say, the current page tab of a navigation menu is always some particular color), you can do this in ASP by adding a class or id attribute to the menu item when it is clicked. I'm not an ASP kind of guy, but in PHP, you can do it by doing something like:

<li><a href="/?page=n">page #n</a></li>

and then when the page in question is loaded, the navigation code should say something like:

if $_GET[page]=n then echo " class=\"selected\"" into the anchor tag.

know what i mean? I didn't type out the code for the above if statement because I'm pretty sure ASP is a little different from PHP, and you would have to translate anyway, but I hope this is helpful.

Andy

Edit: ## Here's my ASP guesswork after a brief encounter with google: ##

<li 
<%

if Request.QueryString("page")==n Then
    Response.Write(" class=\"selected\"")
%>
><a href="/?page=n">Page #n</a></li>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号