JavaScript,VbScript:如何对URL进行编码实现UrlEncoding
作者:admin 日期:2009-03-01
程序代码<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
strreturn = strreturn & thischr
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>
str="中文Abc"
alert(escape(str))
alert(urlencoding(str))
</script>
评论: 0 | 引用: 0 | 查看次数: 795
发表评论
上一篇
下一篇


文章来自:
Tags: 




