网络编程
位置:首页>> 网络编程>> JavaScript>> 用JavaScript实现UrlEncode和UrlDecode功能

用JavaScript实现UrlEncode和UrlDecode功能

 来源:asp之家 发布时间:2008-01-27 11:30:00 

标签:UrlEncode,UrlDecode,编码,url

对url进行编码在服务器端我们可以使用asp中的server.urlencode,很方便实现。如:

<%
ss="asp之家欢迎您!Aspxhome.com"
response.write server.urlencode(ss)
%>

而在客户端我们可以使用js中encodeURI,encodeURIComponent函数来实现,但是经过这些函数编码的url地址都说UTF-8格式的,只能用在这种编码的网页。其它编码的网页将出现乱码,本文介绍了使用自定义函数来实现asp中的类似server.urlencode的功能:


0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com