Create Class Name From URL In ASP


/ Published in: ASP
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.