實例
<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/