We Recommend

ASP.NET 3.5 Unleashed ASP.NET 3.5 Unleashed
ASP.NET 3.5 Unleashed is the most comprehensive book available on the Microsoft ASP.NET 3.5 Framework, covering all aspects of the ASP.NET 3.5 Framework--no matter how advanced.


Posted By

neal_grosskopf on 06/10/08


Tagged

css ASP


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

neal_grosskopf


Create Class Name From URL In ASP


Published in: ASP 


URL: http://www.nealgrosskopf.com/tech/thread.asp?pid=15

Use this function to create a unique class name based on the page's url. It makes for a great way to drill down with specificity in CSS later by placing this on the ID or as a Class on the body tag.

  1. function CreatePageClassName()
  2.  
  3. url = lcase(request.ServerVariables("URL"))
  4. url = right(url,len(url)-1)
  5. url = replace(url,"/","_")
  6. url = replace(url,".asp","")
  7.  
  8. CreatePageClassName = "url_" & url
  9.  
  10. end function

Report this snippet 

You need to login to post a comment.