"+" is odd, you might want to try yourvalue = encodeURIComponent(yourvalue);but it might break some other things
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>
if thischr="+" or thischr=" " then => if thischr="+" or thischr=" " or thischr="&" or thischr="=" then
<body>
<form method=get >
<input name=a>
<input type=submit value=确定>
</form>
</html>
yourvalue = encodeURIComponent(yourvalue);but it might break some other things
要求 版本 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>
=>
if thischr="+" or thischr=" " or thischr="&" or thischr="=" then