密码框显示提示文字jquery示例
2018-10-12 14:01
585 查看
<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> 账号:</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>
您可能感兴趣的文章:
相关文章推荐
- 密码框显示提示文字
- extjs完美实现“密码框显示提示文字,不显示输入文字”的变态需求!!!
- 密码框显示提示文字jquery示例
- 基于JS实现密码框(password)中显示文字提示功能代码
- 密码框显示提示文字
- jquery实现密码框显示提示文字
- 密码框显示提示文字
- img 的alt 属性; 鼠标停在图片上为何显示不出提示文字了呢
- android EditText 中显示Error提示的时候文字不见了
- 文本框默认显示的字(提示的文字),点击后文字消失。
- 第三方工具 - echarts中 设置x||y轴文案、提示文字等为固定字数,超出显示"..."
- 鼠标悬停上显示出提示文字
- 让后台程序在桌面显示提示文字,并自动消失
- 输入框显示输入提示,点击消失。没输入直接提交,提交的输入框内容为空,不提交显示的提示文字
- 【echo】命令的功能是在显示器上显示一段文字,一般起到一个提示作用。
- iOS 开发单元格没有数据时显示提示文字
- Win7任务栏缩略图预览效果改为显示文字提示而无窗口预览的方法
- jquery 登陆窗口用户名、密码显示提示框
- jQuery实现表单input中提示文字value随鼠标焦点移进移出而显示或隐藏的代码
- 使用jQuery实现显示文字气球的提示