欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery登陸判斷簡(jiǎn)單實(shí)現(xiàn)代碼

 更新時(shí)間:2013年04月21日 15:53:11   作者:  
登陸判斷在實(shí)際應(yīng)用中還是比較常見,在客戶端執(zhí)行判斷可以減少服務(wù)器端的負(fù)擔(dān),感興趣的朋友可以參考下
復(fù)制代碼 代碼如下:

<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('用戶名不能為空');
//重新獲得焦點(diǎn)
// $('#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="請(qǐng)輸入用戶名" /><br />
密 碼:<input id="txtPassWord" type="text" value="請(qǐng)輸入密碼" /><br />
<input id="btnSubmit" type="button" value="btnSubmit" />
</body>

相關(guān)文章

最新評(píng)論