JavaScript学习笔记

1.判断文本框的内容

<script>

    function ajax_addly() {
        var name = document.getElementById('name');
        var password = document.getElementById('pw');
        //alert(name.value);
        if (name.value == '') {
            alert('请输入账号');
            return;
        }
        if (password.value == '') {
            alert('请输入密码');
            return;
        }
        alert('登录成功!');
    }

<asp:TextBox ID="name" placeholder="账号" runat="server"></asp:TextBox>
<asp:TextBox ID="pw" placeholder="密码" runat="server"></asp:TextBox>


<p>
<input type="button" value="确定" onclick="ajax_addly()" />
</p>




</script>

 

posted on 2018-08-11 13:36  Jtuzi小兔  阅读(113)  评论(0)    收藏  举报