반응형
submit 하기
ex) 1을 입력하면 page_a로가고 2는 page_b, 3은 page_c로 간다.
<html>
<head>
<script>
function form_submit(){
if(num.value==1){
document.test.action="page_a.html";
document.test.submit();
}
else if(num.value==2){
document.test.action="page_b.html";
document.test.submit();
}
else{
document.test.action="page_c.html";
document.test.submit();
}
}
</script>
</head>
<body>
<form name="test" id="test" action="POST">
<input type="text" id="num" value="">
<input type="button" onclick="form_submit();" value="submit">
</body>
</html>
반응형
'웹개발 > javascript' 카테고리의 다른 글
[javascript]타이머(setTimeout) (0) | 2013.12.18 |
---|---|
[javascript]일시정지(sleep) (0) | 2013.12.18 |
[javascript]페이지이동, 뒤로가기 (location,history) (0) | 2013.12.12 |
[javascript]현재시간 출력(custom function) (0) | 2013.12.12 |
[javascript]새로고침(reload) (0) | 2013.12.12 |