请问window.location.href以post方式传递参数的方法

2025-03-24 03:20:00
推荐回答(5个)
回答1:

1、首先输入下方的命令代码:

   

2、然后输入下方的命令代码:

document.write("

");  

document.write("");  

3、然后输入下方的命令代码:

document.write("");  

document.form1.submit();  

  ,就完成了。

回答2:

可以这样:

回答3:

window.location.href="a.asp?name=<%server.URLEncode("+username+")%>"
改为这样试试~这样会对你的参数进行编码,显示的样式如:a.asp?name=%C9%CC%B3%AC%D5%FB%CC%E5%B2%DF%BB%AE

回答4:

function winPostHref(url,params){
var temp=document.createElement("form");
temp.action=URL;
temp.method="POST";
temp.style.display="none";
if(params != null){
for(var x in params) {
var opt=document.createElement("input");
opt.name=x;
opt.type='hidden';
opt.value=params[x];
temp.appendChild(opt);
}
}
temp.submit();
return temp;
}

回答5:

用post方式提交