Space in querystring

Results 1 to 3 of 3

Thread: Space in querystring

  1. #1
    Join Date
    Dec 1969

    Default Space in querystring

    Is there a function in javascript that does the same as the vbscript replace function? I have a string that contains two words and I want to pass it using querystring. I need to change the space to a %20 between the words. I tried URLEncode be cannot get it to work. The script I am using follows. By the way, Javascript is not one of my strengths.<BR><BR>function HandleChange1() {<BR> <BR>var the_select = window.document.theform.selorg;<BR><BR>var the_index = the_select.selectedIndex;<BR><BR>var the_selected = the_select.options[the_index].text;<BR><BR>parent.frames["frleftbot"].document.location.href="test2.asp?org=" + the_selected ;<BR>}<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Space in querystring

    There is a replace function in JavaScript - it&#039s a method of the string object, and it uses a regular expression for patern matching.<BR><BR>var the_selected = the_select.options[the_index].text;<BR>the_selected.replace(/ /i, "%20");<BR>...<BR><BR>See and for more info.<BR><BR>Dunc

  3. #3
    J Guest

    Default RE: Space in querystring

    in javascript use escape("place your string here") instead of URLEncode.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts