JS中decodeURI()与decodeURIComponent()区别
<html><body><script type="text/javascript">var test1="http://www.wljcz.com/My first/";var nn=encodeURI(test1);var now=decodeURI(test1);document.write(nn+ "<br />");document.write(now);var test1="http://www.wljcz.com/My first/";var bb=encodeURIComponent(test1);var nnow=decodeURIComponent(bb);document.write(bb+ "<br />");document.write(nnow);</script></body></html>
其运行结果为:
http://www.wljcz.com/My%20first/
http://www.wljcz.com/My first/
http%3A%2F%2Fwww.wljcz.com%2FMy%20first%2F
http://www.wljcz.com/My first/