js前端实现给url数据加密的方法
传参页面
<script type=”text/javascript”>// <![CDATA[function send(){
var url = "test01.html";
var userName = $("#userName").html();
window.open(encodeURI(url + "?userName=" + userName)); }
// ]]>
</script>
接收参数页面
<script>
var urlinfo = window.location.href;//获取url
var userName = urlinfo.split(“?”)[1].split(“=”)[1];
$(“#userName”).html(decodeURI(userName));
</script>