首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

JS中decodeURI()与decodeURIComponent()差别

2012-09-01 
JS中decodeURI()与decodeURIComponent()区别htmlbodyscript typetext/javascriptvar test1http

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/

热点排行