Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function OpenWindowWithPost(url, windowoption, name, params)
  2.    {
  3.             var form = document.createElement("form");
  4.             form.setAttribute("method", "post");
  5.             form.setAttribute("action", url);
  6.             form.setAttribute("target", name);
  7.  
  8.             for (var i in params) {
  9.                 if (params.hasOwnProperty(i)) {
  10.                     var input = document.createElement('input');
  11.                     input.type = 'hidden';
  12.                     input.name = i;
  13.                     input.value = params[i];
  14.                     form.appendChild(input);
  15.                 }
  16.             }
  17.            
  18.             document.body.appendChild(form);
  19.            
  20.             //note I am using a post.htm page since I did not want to make double request to the page
  21.            //it might have some Page_Load call which might screw things up.
  22.             window.open("post.htm", name, windowoption);
  23.            
  24.             form.submit();
  25.            
  26.             document.body.removeChild(form);
  27.     }
  28.  
  29.    function NewFile()
  30.    {
  31.        var param = { 'uid' : '1234'};                  
  32.       OpenWindowWithPost("NewFile.aspx",
  33.       "width=730,height=345,left=100,top=100,resizable=yes,scrollbars=yes",
  34.       "NewFile", param);       
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement