You can do still do it with asp: http://stackoverflow.com/questions/188124/programmatic-solution-to-change-navigation-id-to-highlight-current-page-asp-net
Or if you really want to use JavasScript, the same solution above applies: var pathname = window.location.pathname; pathname = pathname.substring(pathname.lastIndexOf('/') +1,pathname.indexOf('.asp')) $('body').addClass(pathname); On Mar 1, 5:47 pm, expresso <dschin...@gmail.com> wrote: > But I'm using a asp.net master page and inheriting it's body. so my pages > only will have one global body tag. > > > > mkmanning wrote: > > > Unless your only option is to resort to JavaScript, this is something > > you could do with CSS alone, if you put an id or class on the body tag > > for each page and just rely on the CSS hierarchy to change the style > > for each list item. It also has the advantage of working immediately, > > instead of waiting for domready for example, and even works when > > script is disabled, and can reduce code complexity. > > > CSS: > > body.home ul li.home, > > body.about ul li.about, > > body.contact ul li.contact { > > color:red; > > } > > > HTML: > > > <body class="about"> > > > <div id="menu"> > > <ul> > > <li class="home"> default.aspx home </li> > > <li class="about"> about.aspx about </li> > > <li class="contact"> contact.aspx contact </li> > > </ul> > > </div> > > > On Mar 1, 4:53 pm, expresso <dschin...@gmail.com> wrote: > >> I'm trying to do something simple but this is my first stab at doing this > >> in > >> JQuery. > > >> <div id="menu"> > >> <ul> > >> <li class="current_page_item"> default.aspx > >> home </li> > >> <li> about.aspx about </li> > >> <li> contact.aspx contact </li> > >> </ul> > >> </div> > > >> based on the page, change the css. So like doing a window.location and > >> then > >> parse out the url to the page then check. If it's the about.aspx I need > >> to > >> change the li item's css. > >> -- > >> View this message in > >> context:http://www.nabble.com/Change-CSS-depending-on-page-you%27re-on-tp2228... > >> Sent from the jQuery General Discussion mailing list archive at > >> Nabble.com. > > -- > View this message in > context:http://www.nabble.com/Change-CSS-depending-on-page-you%27re-on-tp2228... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.