sachin
06-03-2003, 02:33 PM
Hi, I have a Url which looks like the below one in the address bar.I need to split on name,value pair,here,so i have a javascript method to split on name/value pair.
http://127.0.0.1:8080/ntl/view/view.htm?id=09000fa08020a14c&p=09000fa08020a14c/7f.pdf#xml=http://127.0.0.1:8080/vtopic.isapi?action=view&Vdkvgwkey=../content/09000fa08020a14c/7f.pdf&doctype=xml&collection=vc1&Queryzip=sql
when the tag name is p in the url-->
the name/value will be p=09000fa08020a14c/7f.pdf
and there needs to be another name//value there
which would be xml=http://127.0.0.1:8080/vtopic.isapi?action=view
The below function jsGetUrl() ,does that,but the location.search.substring(1);
gives the only id=09000fa08020a14c&p=09000fa08020a14c/7f.pdf
when i do the alert in the jsGetUrl function.How do i get the
entire Url,
Note:I think the problem is because i have "#" in the URL.
i cannot remove this since it is my requirement.
Pl refer to the function below .
function jsGetUrl()
{
var oArgObj = new Object();
var sParams = location.search.substring(1);
alert(sParams);
var sPairs = sParams.split("&");
var sPos, sArgname, sValue;
for (var iCnt = 0; iCnt < sPairs.length; iCnt++)
{
sPos = sPairs[iCnt].indexOf('=');
if (sPos == -1) continue;
sArgname = sPairs[iCnt].substring(0,sPos);
alert(sArgname);
sValue = sPairs[iCnt].substring(sPos+1);
alert("pos" + sValue.indexOf('#'));
if (sValue.indexOf('#') != -1 )
{
var aTemp = sPairs[iCnt].split("#");
sValue = aTemp[0].substring(sArgname.length + 2);
alert(sValue);
oArgObj[sArgname] = sValue;
sArgname = "xml" ;
alert(sArgname);
sValue = aTemp[1].substring(sArgname.length + 1);
alert(sValue);
}
alert(sValue);
oArgObj[sArgname] = sValue;
}
return oArgObj;
}
http://127.0.0.1:8080/ntl/view/view.htm?id=09000fa08020a14c&p=09000fa08020a14c/7f.pdf#xml=http://127.0.0.1:8080/vtopic.isapi?action=view&Vdkvgwkey=../content/09000fa08020a14c/7f.pdf&doctype=xml&collection=vc1&Queryzip=sql
when the tag name is p in the url-->
the name/value will be p=09000fa08020a14c/7f.pdf
and there needs to be another name//value there
which would be xml=http://127.0.0.1:8080/vtopic.isapi?action=view
The below function jsGetUrl() ,does that,but the location.search.substring(1);
gives the only id=09000fa08020a14c&p=09000fa08020a14c/7f.pdf
when i do the alert in the jsGetUrl function.How do i get the
entire Url,
Note:I think the problem is because i have "#" in the URL.
i cannot remove this since it is my requirement.
Pl refer to the function below .
function jsGetUrl()
{
var oArgObj = new Object();
var sParams = location.search.substring(1);
alert(sParams);
var sPairs = sParams.split("&");
var sPos, sArgname, sValue;
for (var iCnt = 0; iCnt < sPairs.length; iCnt++)
{
sPos = sPairs[iCnt].indexOf('=');
if (sPos == -1) continue;
sArgname = sPairs[iCnt].substring(0,sPos);
alert(sArgname);
sValue = sPairs[iCnt].substring(sPos+1);
alert("pos" + sValue.indexOf('#'));
if (sValue.indexOf('#') != -1 )
{
var aTemp = sPairs[iCnt].split("#");
sValue = aTemp[0].substring(sArgname.length + 2);
alert(sValue);
oArgObj[sArgname] = sValue;
sArgname = "xml" ;
alert(sArgname);
sValue = aTemp[1].substring(sArgname.length + 1);
alert(sValue);
}
alert(sValue);
oArgObj[sArgname] = sValue;
}
return oArgObj;
}