JavaScript 或者 jQuery 拼接form表单提交

jQuery


 var path_name='${xxxxxx}';
	  $('
').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,拼接form表单提交,jquery,form,javascript,form)