JS中decodeURI()与decodeURIComponent()区别
来源:互联网 发布:售后软件 编辑:程序博客网 时间:2024/05/16 09:39
摘要: 本文章就是介绍两个解码的函数,他们就是decodeURI()和decodeURIComponent()函数,这两个函数可以对特定函数生成的密码字符串进行解密操作,就可以生成为未解密的字符串,比较实用,下面
本文章就是介绍两个解码的函数,他们就是decodeURI()和decodeURIComponent()函数,这两个函数可以对特定函数生成的密码字符串进行解密操作,就可以生成为未解密的字符串,比较实用,下面来看看这两个函数的用法和实例,你就会用了:
decodeURI()定义和用法:decodeURI() 函数可对 encodeURI() 函数编码过的URI 进行解码。
语法:decodeURI(URIstring)
参数 描述:URIstring 必需。一个字符串,含有要解码的 URI 或其他要解码的文本。
返回值:URIstring 的副本,其中的十六进制转义序列将被它们表示的字符替换。
decodeURIComponent()定义和用法:decodeURIComponent() 函数可对 encodeURIComponent() 函数编码的 URI 进行解码。
语法:decodeURIComponent(URIstring)
参数 描述:URIstring 必需。一个字符串,含有编码 URI 组件或其他要解码的文本。
返回值:URIstring 的副本,其中的十六进制转义序列将被它们表示的字符替换。
实例:
- <html>
- <body>
- <script type="text/javascript">
- var test1="http://www.wljcz.com/My first/";
- var nn=encodeURI(test1);
- var now=decodeURI(test1);
- document.write(nn+ "<br />");
- document.write(now);
- var test1="http://www.wljcz.com/My first/";
- var bb=encodeURIComponent(test1);
- var nnow=decodeURIComponent(bb);
- document.write(bb+ "<br />");
- document.write(nnow);
- </script>
- </body>
- </html>
其运行结果为:
http://www.wljcz.com/My%20first/
http://www.wljcz.com/My first/
http%3A%2F%2Fwww.wljcz.com%2FMy%20first%2F
http://www.wljcz.com/My first/
0 0
- JS中decodeURI()与decodeURIComponent()区别
- JS中decodeURI()与decodeURIComponent()区别
- JS中decodeURI()与decodeURIComponent()区别
- JS中decodeURI()与decodeURIComponent()区别
- JS中decodeURI()与decodeURIComponent()区别
- JS中decodeURI()与decodeURIComponent()区别
- JavaScript decodeURI()与decodeURIComponent()区别
- JavaScript decodeURI()与decodeURIComponent()区别
- encodeURI、decodeURI、encodeURIComponent与decodeURIComponent的区别
- java中URLEncoder、URLDecoder 与js中 en/decodeURI()、en/decodeURIComponent()使用
- js encodeURI() decodeURI() encodeURIComponent() decodeURIComponent()
- JS----编码,解码decodeURIComponent,encodeURIComponent,decodeURI,encodeURI
- escape()、encodeURI()、decodeURI()、encodeURIComponent()、decodeURIComponent()区别详解
- js中的编码解码--escape/unescape、encodeURI/decodeURI 、encodeURIComponent/decodeURIComponent
- 一张图看懂encodeURI、encodeURIComponent、decodeURI、decodeURIComponent的区别
- 一张图看懂encodeURI、encodeURIComponent、decodeURI、decodeURIComponent的区别
- unescape decodeURI decodeURIComponent
- unescape,decodeURI,decodeURIComponent
- fragment杂记
- 将30%的时间用于未来: 看看Google的70/20/10分配法则
- 书单
- GCC4.7编译记录
- android4.4 bluetooth上电代码流程一览
- JS中decodeURI()与decodeURIComponent()区别
- (hdu step 4.2.7)Kill the monster(有n个技能,求杀死怪物的技能的最小使用次数。在使用某一个技能的时候,如果怪物的能量值hp<=m,这时候造成的伤害值是原来的两倍)
- java 富文本编辑内容去除格式 正则表达式
- 欢迎使用CSDN-markdown编辑器
- 不说权术,不说潜规则, 说说职场上的小细节
- 欢迎使用CSDN-markdown编辑器
- OC runtime学习笔记一
- Xcode 的正确打开方式——Debugging
- 由一个骂评引发的作者产品体验报告-----我要集气