zoukankan      html  css  js  c++  java
  • jQuery实现简单登陆判断

    <script src="jquery-1.9.1.js"></script>     <script type="text/javascript">

                $('#txtUserName').focus(function () {                 $('#txtUserName').val('');             })

                $('#txtPassWord').focus(function () {                 $('#txtPassWord').val('');             })

                $('#txtUserName').blur(function () {                 if ($('#txtUserName').val() =='')                 {                     $('#txtUserName').val('用户名不能为空');                     //重新获得焦点                   //  $('#txtUserName').focus();                 }             })             $('#txtPassWord').blur(function () {                 if ($('#txtPassWord').val() == '') {                     $('#txtPassWord').val('密码不能为空');                 }             })             $('#btnSubmit').click(function () {                 if ($('#txtUserName').val() == 'admin' && $('#txtPassWord').val() == '888888')                 { alert('登陆成功!'); }                 else { alert('登陆失败!'); }             })         })     </script> < /head> < body>

        用户名:<input id="txtUserName" type="text" value="请输入用户名" /><br />     密 码:<input id="txtPassWord" type="text" value="请输入密码" /><br />     <input id="btnSubmit" type="button" value="btnSubmit" /> < /body>

  • 相关阅读:
    LeetCode | Remove Duplicates from Sorted List
    LeetCode | Remove Duplicates from Sorted Array
    LeetCode | Merge Sorted Array
    opencv的配置、使用
    LeetCode | Merge Two Sorted Lists
    LeetCode | Minimum Depth of Binary Tree
    LeetCode | Same Tree
    LeetCode | Maximum Depth of Binary Tree
    LeetCode | Insertion Sort List
    python运算符优先级
  • 原文地址:https://www.cnblogs.com/qiqiBoKe/p/3031828.html
Copyright © 2011-2022 走看看