关于javascript中encodeURI和decodeURI的使用方法
来源:才华咖 本文已影响2.06W人
来源:才华咖 本文已影响2.06W人
一、基本概念
encodeURI和decodeURI是成对来使用的,因为浏览器的`地址栏有中文字符的话,可以会出现不可预期的错误,所以可以encodeURI把非英文字符转化为英文编码,decodeURI可以用来把字符还原回来。encodeURI方法不会对下列字符进行编码:":"、"/"、";" 和 "?",encodeURIComponent方法可以对这些字符进行编码。
decodeURI()方法相当于de(URIString, "UTF-8");
encodeURI()方法相当于de(URIString, "UTF-8");
二、例子
复制代码 代码如下:
var uriStr = "张三&num=001 zs";
var uriec = encodeURI(uriStr);
e("编码后的" + uriec);
var uridc = decodeURI(uriec);
e("解码后的" + uridc);
编码后的
解码后的张三&num=001 zs
A Letter to Univsity Pesident about the Canteen Service on C
AndroidApp中使用SurfaceView制作多线程动画的实例讲解
Win10系统提示Officebackgroundtaskhandler.exe弹窗问题的解决方
Efforts Urged to Improve Womens Reproductive Health英语阅读
Young Actors Are Criticized大学英语作文
UN Chief Urges Leaders to Deliver on Climate Change美文欣赏
jQuery中的read和JavaScript中的onload函数的区别在哪
英语满分作文:Reading-TheBestMeanstoAcquireknowledge
A Lifeguard at Johns Beach Saved a Drowning Child,A Lifeguar英语作文
java script remove Child的使用注意事项
八年级《unit8 Why don’t you get her a scarf? Period1》评课稿
四级作文:Create a Conservation-Oriented Campus
Chinas Liu to seek injury advice in US soon英语作文
英语阅读:Covergirl unveils empowering brand update
JavaScript在Android的WebView中parseInt函数转换不正确
英语报纸解读:Data may disrupt a peculiar business大纲
Its Our Duty To Protect Our Environment-作文及点评
A Bitter Experience in My Childhood初中英语作文
,javascript break和continue区别
Compare with the domestic hen and the duck英语作文
关于javascript中encodeURI和decodeURI的使用方法
英语作文introduce a few favorite books
私家车的坏处The Disadvantages of Private Cars英语作文
初一英语Unit 12 My favorite subject is science 课后练习题答
关于练习贝司时使用节拍器的方法
Jolie drops battle over perfume named Shilohy英语作文
Diaspora Finance Powers Global Development美文欣赏
高中英语作文:My approach to difficulties in learning
A Letter to the University President为题目的作文
英语作文: The Uncivilized Internet Words
Unit six Opening and Closing Ceremonies口译材料
关于说明文的使用方法及技巧
Ought Parents to Give Children Pocket英语作文
The relationship between theory and practice大学英语作文
英语作文Never judge a book by its cover
Food and place of interest in Beijing初中英语作文
英语美文阅读:Kerry: Anti-IS Coalition Could Contribute to B
World Day to Combat Desertification大学英语作文
无线咪的介绍和使用方法
《You Cant Judge a William by Its Cover》英语美文欣赏