• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
james1207

博客园    首页    新随笔    联系   管理    订阅  订阅

密码框显示提示文字

<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>


posted @ 2013-08-29 20:24  Class Xman  阅读(356)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3