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
C# asp.net - Set object visibility based on browser type
How to configure VRRP
Passing PChar parm to DLL
isa 2004 and iis7
office 2003 keeps self installing over 2007
code for an application which can read a portion of the screen and writes it on another portion of the screen.
how can i upload 900 mb file to internet ,is there any website to free upload ?
Setting Compatibility Mode in IE8 using JavaScript
Need help with 'System.Web.UI.ScriptManag
er is not defined error
I am new to webservices, please help.