您的位置:首页 > 运维架构

利用window.open实现post方式的参数传递

2013-08-28 11:03 381 查看
function openPostWindow(url, data, name)

2 {

3 var tempForm = document.createElement("form");

4 tempForm.id="tempForm1";

5 tempForm.method="post";

6 tempForm.action=url;

7 tempForm.target=name;

8

9 var hideInput = document.createElement("input");

10 hideInput.type="hidden";

11 hideInput.name= "content"

12 hideInput.value= data;

13 tempForm.appendChild(hideInput);

14 tempForm.attachEvent("onsubmit",function(){ openWindow(name); });

15 document.body.appendChild(tempForm);

16

17 tempForm.fireEvent("onsubmit");

18 tempForm.submit();

19 document.body.removeChild(tempForm);

20 }

21

22 function openWindow(name)

23 {

24 window.open('about:blank',name,'height=400, width=400, top=0, left=0, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes,location=yes, status=yes');

25 }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: