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/

猜你喜欢

转载自blog.csdn.net/lzj470612639/article/details/81235202
今日推荐