JavaScript encodeURI() 函数

encodeURI() 函数可把字符串作为 URI 进行编码。

--------------------------------------------------------------------------------------------

输入:

<script type="text/javascript">

document.write(encodeURI("http://www.w3school.com.cn")+ "<br />")
document.write(encodeURI("http://www.w3school.com.cn/My first/"))
document.write(encodeURI(",/?:@&=+$#"))

</script>

-------------------------------------------------------------------------------------------------

输出:

http://www.w3school.com.cn
http://www.w3school.com.cn/My%20first/
,/?:@&=+$#

 

原文链接:http://www.w3school.com.cn/jsref/jsref_encodeuri.asp

posted @ 2014-04-30 10:56  huazhiliange  阅读(235)  评论(0编辑  收藏  举报