You are viewing this page out of context. To see it in the context it is intended please click here.
About This Page
Reply posted by Jake Howlett on Tue 24 Apr 2001 in response to Opening database relative URLs in JavaScript
Perfect compromise
Okee dokee. Here is a compromise that should cater for ALL circumstances:*************
var p = location.pathname;
path = p.slice( 1, p.toLowerCase().lastIndexOf('.nsf')+4) + '/';
*************
This way it doesn't matter what variation of Nn, Ss and Ff we have as it
converts it all to lowercase before finding its postion. Note that toLowerCase
has no effect on the original string so it will come out of the calculation
unaffected.
Jake
-CodeStore