不好用  我是在jsp中将带有+的变量窜给javascript的、
再由javascript刷新一页

解决方案 »

  1.   

    把以下内容存为一个HTM档,有些字符不知道怎么传的话,就拷到Input里,然后敲回车,看一看网址栏后面的东西就知道了<html>
    <body>
    <form method=get >
    <input name=a>
    <input type=submit value=确定>
    </form>
    </html>
      

  2.   

    "+" is odd, you might want to try
    yourvalue = encodeURIComponent(yourvalue);but it might break some other things
      

  3.   

    encodeURIComponent
    要求 版本 5.5<script>
    alert(encodeURIComponent("我+You"))
    </script>还是自定义函数吧
    <script language="vbscript">
    function urlencoding(vstrin)
    dim i,strreturn
        strreturn = ""
        for i = 1 to len(vstrin)
            thischr = mid(vstrin,i,1)
            if abs(asc(thischr)) < &hff then
    'Yang
    if thischr="+" or thischr=" " then
                strreturn = strreturn & "%" & hex(asc(thischr))
    else 
                strreturn = strreturn & thischr
    end if
    'End
            else
                innercode = asc(thischr)
                if innercode < 0 then
                    innercode = innercode + &h10000
                end if
                hight8 = (innercode  and &hff00)\ &hff
                low8 = innercode and &hff
                strreturn = strreturn & "%" & hex(hight8) &  "%" & hex(low8)
            end if
        next
        urlencoding = strreturn
    end function
    </script>
    <script language="javascript">
    alert(urlencoding("我+You"))
    </script>
      

  4.   

    if thischr="+" or thischr=" " then
    =>
    if thischr="+" or thischr=" " or thischr="&" or thischr="=" then