동적 폼 시뮬레이션 제출 만들기

6230 단어 만들다
        //
        function openPostWindow(orderNo,lineNums,productIds){
            var tempForm = document.createElement("form");
            tempForm.id = "tempForm1";
            tempForm.method = "post"; // 
            tempForm.target = "_self";
            tempForm.action = "sys_om_order_copy_to.aspx"; // url
            
            // 
            //1  2 lineNums 3 productIds
            
            var hidInput_orderNO = document.createElement("input");
            hidInput_orderNO.type = "hidden";
            hidInput_orderNO.name = "orderNO";
            hidInput_orderNO.value = orderNo;
            tempForm.appendChild(hidInput_orderNO);
            
            var hidInput_lineNums = document.createElement("input");
            hidInput_lineNums.type = "hidden";
            hidInput_lineNums.name = "lineNums";
            hidInput_lineNums.value = lineNums;
            tempForm.appendChild(hidInput_lineNums);
            
            var hidInput_productIds = document.createElement("input");
            hidInput_productIds.type = "hidden";
            hidInput_productIds.name = "productIds";
            hidInput_productIds.value = productIds;
            tempForm.appendChild(hidInput_productIds);
            
            //attachEvent(IE) addEventListener 
            /*if (window.attachEvent) { 
               tempForm.attachEvent("onsubmit", function () { openWindow(); });
            } else if (window.addEventListener) { 
                tempForm.addEventListener("onsubmit", function () { openWindow(); },false);   
            }*/             
            
            document.body.appendChild(tempForm);
            
            if(document.all){  
                tempForm.fireEvent("onsubmit");  
            }else {   
                var evt = document.createEvent('HTMLEvents');  
                    evt.initEvent('onsubmit',true,true);  
                    tempForm.dispatchEvent(evt );  
              }
            // 
            tempForm.submit(); 
            document.body.removeChild(tempForm); // 
        }

좋은 웹페이지 즐겨찾기