escape() 方法:
encodeURI() 方法:
encodeURIComponent() 方法:
另外,encodeURI/encodeURIComponent是在javascript1.5之后引进的,escape则在javascript1.0版本就有。
<title> url字符串的加密与解密 </title>
<script language="JavaScript">
var str="http://hi.baidu.com/bbjjss2008l?country=中国&name=jz";
var urlStr=escape(str);
document.write("escape方法加密:<br>"+urlStr+"<br>解密后url字符串是:<br>"+unescape(str));
urlStr=encodeURI(str);
document.write("<br>encodeURI:方法加密:<br>"+urlStr+"<br>解密后url字符串是:<br>"+decodeURI(str));
urlStr=encodeURIComponent(str);
document.write("<br>encodeURIComponent:方法加密:<br>"+urlStr+"<br>解密后url字符串是:<br>"+decodeURIComponent(str));
</script>