form태그 내 input(type=text) 1개일 시, input에서 엔터키입력=>자동 submit
case1. input(text) 1개일 때 자동 서브밋을 그대로 이용. (onkeypress 를 넣지 않음)
========================================================
<script>
function check(){
if(!(document.f.pwd.value=="1234"))
return false;
}
</script>
<form action="2.jsp" method="post" name="password" onsubmit="return check()">
<input type="text" name="pwd">
</form>
=========================================================
case2. 강제로 input(text) 2개를 만듬. (추천?)
=========================================================
<script>
function enter(){
if (event.keyCode == 13)
check();
}
function check(){
if( document.f.pwd.value=="1234")
password.submit();
else
return false;
}
</script>
<form action="2.jsp" method="post" name="password" onsubmit="return check()">
<input type="text" name="pwd" onkeyperss="enter()">
<input type="text" style="display: none;">
</form>