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()
  3. url = lcase(request.ServerVariables("URL"))
  4. url = right(url,len(url)-1)
  5. url = replace(url,"/","_")
  6. url = replace(url,".asp","")
  8. CreatePageClassName = "url_" & url
  10. end function


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.