让一个表单以post的方式在window.open的窗口中打开

我们都知道window.open(url)是最基本的用法,很多人都在url里用?xx=11&yy=22的方式拼接参数,但是其实我们不愿意让使用者看到后面的参数,这时我们可以如下方法

 

JS如下:

var new_win=window.open("",winName,"height="+height+",width ="+width+",top="+(window.screen.height-height)/2+",
    left="+(window.screen.width-width)/2+",location =0,menubar=0,resizable=1,scrollbars =yes,status =0,toolbar =0,titlebar =0");
$(formId).method='post';
$(formId).action=action;
$(formId).target=winName;
$(formId).submit();    
new_win.focus();

 

posted @ 2013-08-30 11:10  自行车上的程序员  阅读(482)  评论(0编辑  收藏  举报