js前端實(shí)現(xiàn)給url數(shù)據(jù)加密的方法
1.傳參頁(yè)面
<script type=”text/javascript”>// <![CDATA[function send(){
var url = "test01.html";
var userName = $("#userName").html();
window.open(encodeURI(url + "?userName=" + userName)); }
// ]]>
</script>
2.接收參數(shù)頁(yè)面
<script>
var urlinfo = window.location.href;//獲取url
var userName = urlinfo.split(“?”)[1].split(“=”)[1];
$(“#userName”).html(decodeURI(userName));
</script>