JavaScrit 對 URI 進行 編碼 /解碼

實例

<script type="text/javascript">

var test1="http://www.w3school.com.cn/My first/"

document.write(encodeURI(test1)+ "<br />")
document.write(decodeURI(test1))

</script>

輸出:

http://www.w3school.com.cn/My%20first/
http://www.w3school.com.cn/My first/

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章