JAVA/자바스크립트
자바스크립트 submit하기
왕왕왕왕
2015. 8. 25. 16:05
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>