当前位置: 代码迷 >> Web前端 >> 应用window.open提交form表单
  详细解决方案

应用window.open提交form表单

热度:103   发布时间:2012-11-07 09:56:10.0
使用window.open提交form表单

今天碰到一个应用,需要在一个固定的Windows中展示数据,而数据又是通过form表单发给Servlet处理并forward(request, response)到另一个view页面来统一展示的
..好吧 表达有点不好..

现在需要,点提交按钮后open一个新的固定页面,并提交父页面的表单数据.
查询关于Window.open
oNewWindow = window.open( [sURL] [, sName] [, sFeatures] [, bReplace])
其中sName这个参数是这么定义的
sName Optional. String that specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an a element.
target是设置或获取目标内容要显示于哪个窗口或框架.
所以就可以这么写了~

chartForm.target = "newWindow";   
var win = window.open("about:blank","newWindow","height=650,width=1000,scrollbars=yes,status=yes,toolbar=no,menubar=no,location=no");   
win.focus();   
chartForm.submit(); 

?这里先打开一个about:blank 为了避免像Servlet传递空数据,然后焦点上移,提交.ok~

  相关解决方案