function upload(enterid){
// document.all('formname').method = "get";
document.all('formname').action="uploadsinglepic?enterid="+enterid;
alert(enterid);
document.all('formname').submit();
}
我在Struts2 action中System.out.println(enterid);
System.out.println(ServletActionContext.getRequest().getParameter("enterid"));
都无法获取enterid值?求帮助!!!
<input type="hidden" id="enterid" name="enterid">然后JS中:
document.getElementById("enterid").value = enterid;
为什么<a href></a> 这种方式却能Get
是不是js 底层根本没有实现Get方式?
只有window.href或replace你的带?好的url就好了。
我一般用 window.location.href='xx.action';
document.all() 有的浏览器不支持该属性
window.location.href='xx.action'; 这个方法如果是针对用了框架集的,好像不太好用!
如果想跳转顶级页面,可以用 top,类似:
top.location = 'xx.action';但这样只能支持GET方式,URL传参。
document.myform.submit();
这样是可以的,action里要有stateType属性的get\set方法