Page 1 of 1
# anchor causes problems
Posted: Mon Sep 06, 2004 5:58 am
by gurjit
hi all,
i have a url string i pass through as follows:
http://www.mydomain.com/page.php?id=1&w ... &adr2=king road&city=london
the # in adr1 variable causes the page to stop printing adr2,city.
any variable after adr1 will not print on the page.
how can i stop this from happening?
Posted: Mon Sep 06, 2004 6:05 am
by feyd
urlencode the #.. it's a url hash marking.
%23 = #
Posted: Mon Sep 06, 2004 6:27 am
by gurjit
I have a javascript that creates the string to pass through. how can i do this in the javascript?
Code: Select all
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function passall () {
makestring = "a=a"
for (i=0;i<document.form1.elements.length;i++) {
if (document.form1.elementsїi].type == "radio" || document.form1.elementsїi].type == "checkbox") {
if (document.form1.elementsїi].checked == true) {
makestring = makestring + "&" + document.form1.elementsїi].name + "=" + document.form1.elementsїi].value
}
}
else
{
makestring = makestring + "&" + document.form1.elementsїi].name + "=" + document.form1.elementsїi].value
}
}
document.location.href = "principal_user_edit.php?stop=stop&" + makestring
}
//-->
</SCRIPT>
feyd | please use the forum's tags!
Posted: Mon Sep 06, 2004 6:30 am
by feyd
Javascript has a lovely little function called 'escape' that does it.
Posted: Mon Sep 06, 2004 6:31 am
by timvw
I don't know JavaScript very well, but i think you could use escape function.
Posted: Mon Sep 06, 2004 7:25 am
by gurjit
you were right...the escape function around the value part worked great.
thanks all...