View Full Version : parsing out basename from location.pathname?
05-09-2006, 01:46 AM
Will return: "etc/etc/etc/bobs_page.html"
05-09-2006, 02:49 AM
05-09-2006, 03:30 AM
Exactly what I was looking for; here is how I finished it after looking up 'substring' and 'lastIndexOf' based on your suggestion.
// get instructor name
var instructorName = pathName.substring(startLoc, endLoc);
05-09-2006, 06:22 AM
You can also take out the 'var endLoc' line and just do:
var instructorName=pathName.substring(startLoc, pathName.length-5);
It does the same thing as the endLoc variable but it basially counts how many characters are in the whole string and then subtracts 5 characters from the end of the string and those 5 characters will be '.html'. Its just a shorter way to do the same thing, just giving you some options.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.