日期:2014-05-16 浏览次数:20334 次
用户名: <input type="text" name="user" id="txtUserName" runat="server" class="Logo_Input" />
密码: <input type="password" name="pwd" id="txtUserPwd" runat="server" class="Logo_Input" />
验证码: <input name="chknumber" type="text" id="txtChknumber" maxlength="4" runat="server" class="Logo_Input chknumber_input" />
<a href="#" id="inputLogo" class="Logo_button_01" onserverclick="login_Click" runat="server">提交</a>
/*文本框初始样式*/
.Logo_Input
{
width: 100px;
height: 17px;
background-color: #87adbf;
border: solid 1px #153966;
font-size: 12px;
color: #283439;
}
/*文本框为空时,改变的文本框样式*/
.Logo_Inputborder{
width: 100px;
height: 17px;
background-color: red;
border: solid 1px #153966;
font-size: 12px;
color: #283439;
}
/*验证非空*/
$(document).ready(function(){
$('#inputLogo').click(function(event){
var txtUserName=$('#txtUserName').val();
var txtUserPwd=$('#txtUserPwd').val();
var txtChknumber=$('#txtChknumber').val();
if(txtUserName.length<1)
{
$('#txtUserName').addClass('Logo_Inputborder');
event.preventDefault();
} else if(txtUserPwd.length<1)
{
$('#txtUserPwd').addClass('Logo_Inputborder');
event.preventDefault();
} else if(txtChknumber.length<1)
{
$('#txtChknumber').addClass('Logo_Inputborder');
event.preventDefault();
}
})});
$(function(){
/*清空*/
$('#Reset').click(function(){
$('input:text').val("");
$('input:password').val("");
});
/*改变文本框颜色*/
$('input:text').focus(function(){
$(this).addClass('Logo_Input');
});
$('input:password').focus(function(){
$(this).addClass('Logo_Input');
});
});