window.OpenシミュレーションフォームPOST発行

3350 ワード


         ,    ,       
   excel      
 form target    open name      ,               post     

var url=“XXX”;
var tempForm = document.createElement("form");           
tempForm.id="tempForm";           
tempForm.method="post";              
tempForm.action=url;       
tempForm.target="blank";           
//      input      
var hideInput = document.createElement("input");           hideInput.type="hidden";           
hideInput.name="ids";  
hideInput.value= ids;         
tempForm.appendChild(hideInput);
if (tempForm.attachEvent) {  // IE 
tempForm.attachEvent("onsubmit",function(){ window.open('about:blank','blank'); });  
} else if (tempForm.addEventListener) {  }
// DOM Level 2 standard  
tempForm.addEventListener("onsubmit",function(){ window.open('about:blank','blank')});  
}              
document.body.appendChild(tempForm);   
if (document.createEvent) { }
// DOM Level 2 standard  
    evt = document.createEvent("MouseEvents");  
    evt.initMouseEvent("submit", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);  
    tempForm.dispatchEvent(evt);  
} else if (tempForm.fireEvent) { // IE   tempForm.fireEvent('onsubmit');  
}  
//               
tempForm.submit();         
document.body.removeChild(tempForm);