----- 010-escape.html -----
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>标题</title> </head> <body> <script type="text/javascript"> URI = "http://www.baidu.com/?#wd=关键字"; document.write("原字符串 " + URI + "<br/><br/>"); document.write("escape后 " + escape(URI) + "<br/>"); document.write("unescape后 " + unescape(escape(URI)) + "<br/><br/>"); document.write("encodeURI后 " + encodeURI(URI) + "<br/>"); document.write("decodeURI后 " + decodeURI(encodeURI(URI)) + "<br/><br/>"); document.write("encodeURIComponent后 " + encodeURIComponent(URI) + "<br/>"); document.write("decodeURIComponent后 " + decodeURIComponent(encodeURIComponent(URI)) + "<br/>"); </script> </body> </html>