decodeURI()函数:
1 <p> </p><p><span class="tag"><html></span><br /><span class="pln"> </span><span class="tag"><body></span><br /><span class="pln"> </span><span class="tag"><script</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"text/javascript"</span><span class="tag">></span><br /><span class="pln"> </span><span class="kwd">var</span><span class="pln"> test </span><span class="pun">=</span><span class="pln"> </span><span class="str">"</span><a href="http://www.test.com/My" rel="nofollow"><span class="str">http://www.test.com/My</span></a><span class="str"> test/"</span><span class="pun">; </span><span class="pln"> </span><br /><span class="pln"> </span><span class="kwd">var</span><span class="pln"> test1 </span><span class="pun">=</span><span class="pln"> encodeURI</span><span class="pun">(</span><span class="pln">test</span><span class="pun">);</span><br /><span class="pln"> </span><span class="kwd">var</span><span class="pln"> test2 </span><span class="pun">=</span><span class="pln"> decodeURI</span><span class="pun">(</span><span class="pln">test1</span><span class="pun">);</span><br /><span class="pln"> </span><span class="kwd">var</span><span class="pln"> test3 </span><span class="pun">=</span><span class="pln"> encodeURIComponent</span><span class="pun">(</span><span class="pln">test</span><span class="pun">);</span><br /><span class="pln"> </span><span class="kwd">var</span><span class="pln"> test4 </span><span class="pun">=</span><span class="pln"> decodeURIComponent</span><span class="pun">(</span><span class="pln">test3</span><span class="pun">);</span></p><br /><p><span class="pln"> document</span><span class="pun">.</span><span class="pln">write</span><span class="pun">(</span><span class="pln">test1 </span><span class="pun">+</span><span class="pln"> </span><span class="str">"<br />"</span><span class="pun">);</span><br /><span class="pln"> document</span><span class="pun">.</span><span class="pln">write</span><span class="pun">(</span><span class="pln">test2 </span><span class="pun">+</span><span class="pln"> </span><span class="str">"<br />"</span><span class="pun">);</span><br /><span class="pln"> document</span><span class="pun">.</span><span class="pln">write</span><span class="pun">(</span><span class="pln">test3 </span><span class="pun">+</span><span class="pln"> </span><span class="str">"<br />"</span><span class="pun">);</span><br /><span class="pln"> document</span><span class="pun">.</span><span class="pln">write</span><span class="pun">(</span><span class="pln">test4 </span><span class="pun">+</span><span class="pln"> </span><span class="str">"<br />"</span><span class="pun">);</span><br /><span class="pln"> </span><span class="tag"></script></span><br /><span class="pln"> </span><span class="tag"></body></span><br /><span class="tag"></html></span></p><p> </p>
http://www.test.com/My test/
http%3A%2F%2Fwww.test.com%2FMy%20test%2F
http://www.test.com/My test/