|
I am trying to use the following function to parse URL strings that look like this:
search4.asp?query=hello+world&site=mysite.web.com
I want to be able to just take out the search terms hello and world
Please take a look at the following code and see why it isn't taking out the '+'
and the 'site=mysite.web.com'
<script type="text/javascript">
function URL2Query()
{
var s = document.referrer;
var query = s.substring(s.indexOf("?")+1,s.length);
var Q = query.split("&");
var hash = {};
for(var i=Q.length-1;i>=0;--i)
{
var q = Q[i].split("=");
if(q[0]) hash[q[0]]=unescape(q[1]);
}
|