如:在A.jsp中 有一个js方法 winow.open,目标地址是 xx.do

1、在A.jsp建一个form,把要设置的值通过js动态添加到里面,如:

$("#postForm").append('<input type="hidden" name="query.id" value="12"/>');
2、设置form的target属性:
$("#postForm").attr("target","newWin");
3、设置form的action:
$("#postForm").attr("action","<%=path%>/xx/xx.do");
4、window.open:
window.open("about:blank","newWin","");//newWin 是上面form的target
5、提交表单:
$("#postForm").submit();

ok,完成上面5步之后,完整的js方法如下:

function openWin(){
   $("#postForm").html('');//防止元素重复
   $("#postForm").append('<input type="hidden" name="query.id" value="12"/>');
   $("#postForm").attr("target","newWin");
   $("#postForm").attr("action","<%=path%>/xx/xx.do");
   window.open("about:blank","newWin","");//newWin 是上面form的target
   $("#postForm").submit();
}

转载自http://www.thinksaas.cn/news/show/431/

相关文章:

  • 2022-12-23
  • 2021-09-11
  • 2021-12-01
  • 2021-06-02
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
猜你喜欢
  • 2021-12-04
  • 2022-12-23
  • 2021-07-10
  • 2021-09-17
  • 2021-06-30
相关资源
相似解决方案