input 리턴 제출

2656 단어 input회차 제출
<script type="text/javascript">
    $(document).ready(function() {
        $("#btnLogin").click(function() {
            submitLoginForm();
        });
    });
    function submitLoginForm(event){
        if(event.keyCode==13) {
            var pass = true;
            if ($.trim($("#nickname").val()) == "") {
                $("#nickname_tip").show();
                pass = false;
            } else {
                $("#nickname_tip").hide();
            }
            if ($.trim($("#password").val()) == "") {
                $("#password_tip").show();
                pass = false;
            } else {
                $("#password_tip").hide();
            }
            if ($.trim($("#verify").val()) == "") {
                $("#verify_tip").show();
                pass = false;
            } else {
                $("#verify_tip").hide();
            }
            if (pass) {
                $("#loginForm").submit();
            }
        } 
    }
</script>
<form id="loginForm" name="loginForm" action="__URL__/checkLogin" method="post" style=" height: auto;" >  
    <p>
        <label> :</label>
        <input type="text" name="nickname" id="nickname" onkeydown="submitLoginForm(event)" />
        <span class="tip" id="nickname_tip"> </span>
    </p>
    <p>
        <label>   :</label>
        <input type="text" name="password" id="password" onkeydown="submitLoginForm(event)"/>
        <span class="tip" id="password_tip"> </span>
    </p>
    <p>
        <label> :</label>
        <input type="text" name="verify" size="4" autocomplete="off" id="verify" onkeydown="submitLoginForm(event)"/>
        <img src="__URL__/verify/" />
        <span class="tip" id="verify_tip"> </span>
    </p>
    <p>
        <input type="button" value="   " class="btnLogin" id="btnLogin" />
    </p>
</form>

좋은 웹페이지 즐겨찾기