+ signs instead of spaces

Results 1 to 2 of 2

Thread: + signs instead of spaces

  1. #1
    Join Date
    Dec 1969

    Default + signs instead of spaces

    When I populate my text boxes on my form with the value I&#039m reading from the cookie, I get + sign instead of spaces. How do I remove replace the + sign with a space. Here is how i get the cookie:<BR><BR>function getCookieVal (offset) {<BR> var endstr = document.cookie.indexOf (";", offset);<BR> if (endstr == -1)<BR> endstr = document.cookie.length;<BR> return unescape(document.cookie.substring(offset, endstr));<BR>}<BR><BR>function GetCookie (name) {<BR> var arg = name + "=";<BR> var alen = arg.length;<BR> var clen = document.cookie.length;<BR> var i = 0;<BR> while (i &#060; clen) {<BR> var j = i + alen;<BR> if (document.cookie.substring(i, j) == arg)<BR> return getCookieVal (j);<BR> i = document.cookie.indexOf(" ", i) + 1;<BR> if (i == 0) break; <BR> }<BR> return "";<BR>}<BR><BR><BR>Thanks

  2. #2
    Bruno Santos Guest

    Default RE: + signs instead of spaces

    that&#039s quite easy.<BR>change your block:<BR><BR>return unescape(document.cookie.substring(offset, endstr));<BR><BR>by this one:<BR><BR>var s=unescape(document.cookie.substring(offset, endstr));<BR>var i;<BR>for (i=0; i&#060;s.length; s++)<BR>{<BR>&nbsp;&nbsp;&nbsp;if (s.charAt(i)==&#039+&#039)<BR>&nbsp;&nbsp;&nbsp;{< BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s=s.substr( 0,i)+&#039 &#039+s.substr(i+1);<BR>&nbsp;&nbsp;&nbsp;};<BR>&n bsp;&nbsp;&nbsp;return s;<BR>}<BR><BR><BR>Brunowski &#060;csbru@bol.com.br&#062;<BR>

Posting Permissions

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