window.location.href后面的url带多个参数

来源:互联网 发布:js浏览器定位 编辑:程序博客网 时间:2024/06/05 08:31
需要的只是一个明传址,这种方式会把参数以明文的方式传过去,这样是不安全的。虽然在技术上是可以实现的。<form action="#">    <input type="text" name="d_id" id="d_id"/><input type="text" name="d_name" id="d_name"/>    <input id="btn" type="button" value="sublimt"/></form><script>    document.getElementById('btn').onclick = function(){        var d = document.getElementById('d_id').value;        var name = document.getElementById('d_name').value;        location.href = 'a.asp?d_id=' + d + '&d_name=' + name;    }</script>========================================<form action="a.asp" method="post" onsubmit="return send();">    <input type="text" name="d_id" id="d_id"/><input type="text" name="d_name" id="d_name"/>    <input id="btn" type="submit" value="sublimt"/></form><script>    function send(){        if(document.getElementById('d_id').value.length < 1){            alert('请正确输入!');            return false;        }        return true;    }</script>
0 0
原创粉丝点击