87,910
社区成员
发帖
与我相关
我的任务
分享
<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>
其实我个人更建议这种post的方式来提交参数。
.asp直接可以根据name值获得input里边的值
<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>