Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extracting portion of URL

Status
Not open for further replies.

tennis

Technical User
Joined
Aug 23, 2001
Messages
18
Location
US
Hi,

I need to extract a portion of a URL and use it as a variable to create another URL. If my URL is:


How do I just extract the state portion of the url?

Thanks in advance
 
<script language=&quot;javascript&quot; type=&quot;text/javascript&quot;>
<!--
var myurl = &quot;var splited = new Array;
splited = myurl.split('&');
alert(splited[1]);
// -->
</script> ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
Thank you for your reply.

Silly....Easy question. How do I get the URL if it is a variable??

Something like location.search.?????

Many thanks
 
var URL = location.href;
or
URL = window.location;
or
URL = window.location.href;
 
jemminger is right
but if your in frame
u could also do
top.location
self.location
framename.location
happy that helped ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top