密碼框顯示提示文字jquery示例
更新時(shí)間:2013年08月29日 18:13:23 作者:
密碼框提示文字的功能還是比較實(shí)用的,下面為大家介紹下使用jquery簡(jiǎn)單的實(shí)現(xiàn)下,喜歡的朋友可以參考下
復(fù)制代碼 代碼如下:
<html>
<head>
<title>登錄</title>
<script type="text/javascript" src="./jquery-1.3.2.min.js"></script>
<script>
$(document).ready(function(){
$(".text_login").focus(function(){
if($(this).val()=='user name' || $(this).val()=='password'){
$(this).val('');
}
if($(this).attr('id')=='password1'){
$(this).hide();
$('#password2').show();
$('#password2').focus();
}
});
$(".text_login").blur(function(){
if($(this).attr('id')=='password2' && $(this).val()==''){
$(this).hide();
$('#password1').show();
$('#password1').val('password');
}
else if($(this).attr('id')=='uname' && $(this).val()=='' ){
$(this).val('user name');
}
});
});
</script>
</head>
<body>
<table cellpadding="0" cellspacing="0" class="tb_login" border="0">
<tr>
<td> 賬號(hào):</td>
<td>
<input type="text" name="uname" value="user name" id="uname" class="text_login"/>
</td>
</tr>
<tr>
<td> 密碼:</td>
<td>
<input type="text" value="password" id="password1" class="text_login"/>
<input type="password" id="password2" style="display:none;" class="text_login"/>
</td>
</tr>
</table>
</body>
</html>
相關(guān)文章
jQuery EasyUI API 中文文檔 - Spinner微調(diào)器使用
jQuery EasyUI API 中文文檔 - Spinner微調(diào)器使用,需要的朋友可以參考下。2011-10-10jQuery插件開發(fā)的五種形態(tài)小結(jié)
這篇文章主要介紹了jQuery插件開發(fā)的五種形態(tài)小結(jié),具體的內(nèi)容就是解決javascript插件的8種特征,非常的詳細(xì),這里推薦給小伙伴們。2015-03-03學(xué)習(xí)從實(shí)踐開始之jQuery插件開發(fā) 對(duì)話框插件開發(fā)
之所以寫下這篇文章,是想將我的想法分享給大家;對(duì)于初學(xué)者,我希望他能從這篇文章中獲取對(duì)他有用的東西,對(duì)于經(jīng)驗(yàn)豐富的開發(fā)者,我希望他能指出我的不足,給我更多的意見和建議;目的就是共同進(jìn)步2012-04-04jquery數(shù)據(jù)驗(yàn)證插件(自制,簡(jiǎn)單,練手)實(shí)例代碼
最近項(xiàng)目中js數(shù)據(jù)驗(yàn)證比較多,為了統(tǒng)一風(fēng)格,移植復(fù)用,于是順手封裝了Jquery的插件2013-10-10基于jquery的文章中所有圖片width大小批量設(shè)置方法
怎么設(shè)置文章中所有圖片width大小批量設(shè)置方法?這在實(shí)際應(yīng)用中很常見,下面有一段示例,希望對(duì)大家有所幫助2013-08-08jQuery在ie6下無(wú)法設(shè)置select選中的解決方法詳解
這篇文章主要介紹了jQuery在ie6下無(wú)法設(shè)置select選中的解決方法,結(jié)合實(shí)例分析了jQuery在ie6下無(wú)法設(shè)置select選中的原因與相關(guān)處理技巧,需要的朋友可以參考下2016-09-09jquery 之 $().hover(func1, funct2)使用方法
.hover(func1, func2) 的效果等效于: mouseenter(), mouseleave()2012-06-06