js前端实现给url数据加密的方法
1.传参页面
<scripttype=”text/javascript”>//<![CDATA[functionsend(){
varurl="test01.html";
varuserName=$("#userName").html();
window.open(encodeURI(url+"?userName="+userName));}
//]]>
</script>
2.接收参数页面
<script>
var urlinfo = window.location.href;//获得url
var userName = urlinfo.split(“?”)[1].split(“=”)[1];
$(“#userName”).html(decodeURI(userName));
</script>
本文来源:https://www.yuntue.com/post/60134.html | 云服务器网,转载请注明出处!