html1:

<!DOCTYPE HTML>

<meta charset=utf-8>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>test</title> <a href="2.htm" v="任晓强" id="test">go</a> <style>
.cur{color:#f00;}
</style> <script>
test.href = test.href + "?" + encodeURIComponent(test.getAttribute("v"));//对任晓强进行编码 </script>

html2:

<!DOCTYPE HTML>

<meta charset=utf-8>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>test</title> <div id="test"></div> <style>
.cur{color:#f00;}
</style> <script>
var name = decodeURIComponent(location.search).replace("?",""); //解码并替换网址 //decodeURIComponent(name); console.log(name) test.innerHTML = "你好" + name; //给test赋值
</script>

encodeURIComponent()编码和decodeURIComponent()解码的更多相关文章

  1. 浏览器URL中 encodeURIComponent()加密和decodeURIComponent()解码

    encodeURIComponent()加密 定义和用法 encodeURIComponent() 函数可把字符串作为 URI 组件进行编码. 语法 encodeURIComponent(URIstr ...

  2. encodeURIComponent编码java后台解码出现乱码问题

    问题:JavaScript请求后台带着name参数,有中文进行编码:url?name=" + encodeURIComponent(name):java后台直接使用name或者name=ja ...

  3. encodeURIComponent()加密、decodeURIComponent()解码及v-html将字符串转换为html

    1)新闻详情页后台给我的数据是加密之后的,我问了后台,是用encodeURIComponent()加密的,然后我就用对应的方法decodeURIComponent()解密: this.$store.s ...

  4. encodeURIComponent编码后java后台的解码 (AJAX中文解决方案)

    encodeURIComponent编码后java后台的解码 (AJAX中文解决方案) 同学的毕业设计出现JavaScript用encodeURIComponentt编码后无法再后台解码的问题. 原来 ...

  5. JS escape、encodeURI 、encodeURIComponent 编码与解码[转]

    转至:http://jc-dreaming.iteye.com/blog/1702407 本文讨论如何对传递参数用JS编码与解码 1:编码与解码方法的对应关系 escape ------------- ...

  6. encodeURIComponent编码2次

    最近在项目中发现前台在往anction中发送数据时进行两次encodeURIComponent,经过上网查找发现以下解释比较合理,mask过来,以供参考,非常感谢原作者!!! 两次encodeURIC ...

  7. encodeURI,encodeURIComponent编码

    encodeURI().encodeURIComponent().decodeURI().decodeURIComponent() URL编码 Global对象的encodeURI()和encodeU ...

  8. encodeURIComponent编码时为什么要编码两次

    Why 要对url进行编码? 当使用地址栏提交查询参数时,如果不编码,非英文字符会按照操作系统的字符集进行编码提交到服务器,服务器会按照配置的字符集进行解码,所以如果两者不一致就会导致乱码.   Wh ...

  9. encodeURIComponent编码反斜杠 \ (正则匹配)

    记录一个小bug... 前言废话: 1. 功能需求:修改输入框的内容,获取字符串传给后端保存. 2. bug历程:刚开始直接获取value值传过去.后来测试发现%&这些特殊字符无法传递后,在前 ...

  10. WebRTC VideoEngine超详细教程(三)——集成X264编码和ffmpeg解码

    转自:http://blog.csdn.net/nonmarking/article/details/47958395 本系列目前共三篇文章,后续还会更新 WebRTC VideoEngine超详细教 ...

随机推荐

  1. 初识Less(2015年05月23日)

    因为最近在研究Bootstrap,然后才了解到Less,听说Less很强大,又听说Bootstrap+Less会更搭,所以就决定也顺带了解下Less的相关知识. come  on...... 一.简介 ...

  2. Git CMD - tag: Create, list, delete or verify a tag object signed with GPG

    命令格式 git tag [-a | -s | -u <keyid>] [-f] [-m <msg> | -F <file>] <tagname> [& ...

  3. HTML特殊符号对照表(转)

    table { border-collapse: collapse; } #htmlchar-container-list { width: 100%; border-top: 2px solid # ...

  4. ADO.NET笔记(一)XML导入导出和数据库

    数据导出成XML文件 #region 数据导出成XML文件 string sql = "select Id, CallerNumber, TelNum, StartDateTime, End ...

  5. BLK-MD-BC04-B蓝牙模块开发说明

    BLK-MD-BC04-B蓝牙模块开发说明 日期:2011-9-24 浏览次数:4178     BLK-MD-BC04-B蓝牙通信模块, BLK-MD-BC04-B蓝牙通信模块 为本公司自主开发的智 ...

  6. 解释清楚c++的重载操作符【用自己的话,解释清楚】

    C++中对于内置的变量及标准库中常见的类定义类常见的操作符含义,对于自定义的类也可以通过关键字operate 重载操作符的含义. C++中支持重载的目的 诚然操作符的重载可以通过使用函数实现同样的功能 ...

  7. Cocos2d-x开发实例介绍特效演示

    下面我们通过一个实例介绍几个特效的使用,这个实例下图所示,下图是一个操作菜单场景,选择菜单可以进入到下图动作场景,在下图动作场景中点击Go按钮可以执行我们选择的特性动作,点击Back按钮可以返回到菜单 ...

  8. minicsv库的编译错误与解决方案

    有一个项目需要写csv文件以呈现数据.Github上有一个关于csv的轻量级读写库minicsv,于是下载之.但是编译example时出现了以下问题: In file included from ex ...

  9. 40个容易上瘾的HTML5网页游戏,总有一款适合你

    我记得姐姐家的孩子在刚刚才学会走路,说话还不能完整的时候就已经能自己用小手点出小游戏的网站来一个人自娱自乐.我一直在想这一代跟着计算机一起茁壮成长的孩子会不会也和美国那一代人一样,出现9岁的黑客和计算 ...

  10. jvmstat监控jvm内存

    1.下载jvmstat-3_0.zip: 2.配置环境变量JVMSTAT_JAVA_HOME为jdk目录E:\Program Files\Java\jdk1.5.0_12 3.监控本机:  jps查看 ...