Microsoft
Software
Hardware
Network
Question : parse url in JavaScript
I have this in my page:
pageURL = window.location + window.location.hash;
the URL ends up looking like this:
http://www.somewhere.com/4
142_234#89
773_367
how can I extract the last 4 parts of the URL, so it would be like this:
idOne='4142';
idTwo='234';
idThree='89773';
idFour='367';
we're splitting at the # and then splitting each one at the _
Answer : parse url in JavaScript
this javascript will get you all four in one array
var myArray = str.split(/#|_/g);
and this will give that last string
var str="
http://www.somewhere.
com/4142_2
34#89773_3
67
";
document.write( str.substring( str.lastIndexOf("/") + 1));
Random Solutions
VFP 6 - Simple Grid on Form and run reports
RHEL command to do an LS and have the result stop until you hit the space bar
How to redirect a subdirectory to an alternate server and retain original URL
swapfile location cannot be changed
Powershell script to create AD accounts from spreadsheet
Delete blank line from textarea
Java Data Array Sorting Advice Needed
what's different between SAP Crystal Reports and SAP Crystal Reports Server 2008?
strange connection speed problem
Finding multiple matches in join and also having 'grandchild' records in t-SQL