JavaScript 或者 jQuery 拼接form表单提交

jQuery


 var path_name='${xxxxxx}';
	  $('<form action="'+path_name+'/manager/index.html" method="post" style="display:none" ><input type="hidden"  name="tradeId"  value="manLogout"/></form>').appendTo('body').submit();



如果新打开窗口  form加上  target = "_blank"; 


javascript


var tempForm = document.createElement("form");  
			  	tempForm.id="tempForm1";  
			  	tempForm.method="post";  
			  	tempForm.action='<%=request.getContextPath()%>/design/taskInfo/didTask.html?task_id='+'${ctx.out.task_id}'+'&bidding_range='+'${ctx.out.bidding_range}';  
			  	tempForm.target=name;  
			 		var hideInput = document.createElement("input");  
			 		hideInput.type="hidden";  
			 		hideInput.name= "tradeId";
			 		hideInput.value= 'didTask';
			 		tempForm.appendChild(hideInput);   
			 		hideInput = document.createElement("input");  
			 		hideInput.type="hidden";  
			 		hideInput.name= "task_id";
			 		hideInput.value= '${ctx.out.task_id}';
			 		tempForm.appendChild(hideInput);   
			 		hideInput = document.createElement("input");  
			 		hideInput.type="hidden";  
			 		hideInput.name= "bidding_range";
			 		hideInput.value= '${ctx.out.bidding_range}';
			 		tempForm.appendChild(hideInput);   

			 		document.body.appendChild(tempForm);  
			 		tempForm.submit();
				  document.body.removeChild(tempForm);

如果新打开窗口  tempForm.target = "_blank"; 

你可能感兴趣的:(JavaScript,jquery,form,form,拼接form表单提交)