티스토리 뷰
<html>
<script language=javascript>
function getPost(mode)
{
var theForm = document.frmSubmit;
if(mode == "01")
{
theForm.method = "post";
theForm.target = "_self";
theForm.action = "test01.asp";
} else if(mode == "02") {
theForm.method = "get";
theForm.target = "_blank";
theForm.action = "test02.asp"
}
theForm.submit();
}
</script>
<body>
<form name=frmSubmit>
<input type=text name=txt1><br>
<input type=text name=txt2><br>
<input type=button name=btn1 value="Submit01" onClick="getPost('01')">
<input type=button name=btn2 value="Submit02" onClick="getPost('02')">
</form>
</body>
</html>
관련출처: http://msoup.tistory.com/entry/Java-script-form-action-%EB%B3%80%EA%B2%BD%EC%98%88%EC%A0%9C
댓글