url加密解密


<script type="text/javascript">
//escape()不能直接用於URL編碼,它的真正作用是返回一個字符的Unicode編碼值。比如"春節"的返回結果是%u6625%u8282,escape()不對"+"編碼 主要用於漢字編碼。
alert(escape("春節"));
alert(unescape(escape("春節")));
//encodeURI()是用來對URL編碼的函數。 編碼整個url地址,但對特殊含義的符號"; / ? : @ & = + $ , #"不進行編碼。對應的解碼函數是:decodeURI()。
alert(encodeURI('http://baidu.com?hello=您好&word=文檔'));
alert(decodeURI(encodeURI('http://baidu.com?hello=您好&word=文檔')));
//encodeURIComponent() 能編碼"; / ? : @ & = + $ , #"這些特殊字符。對應的解碼函數是decodeURIComponent()。
alert(encodeURIComponent('http://baidu.com?hello=您好&word=文檔'));
alert(decodeURIComponent(encodeURIComponent('http://baidu.com?hello=您好&word=文檔')));

</script>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM