zoukankan      html  css  js  c++  java
  • 密码框显示提示文字

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


  • 相关阅读:
    斐波那契数列的递归和非递归实现
    二叉树遍历
    基础总结
    内部类
    I/O dempo
    读取文件注意事项
    eclipse 主题设置
    String 常用函数
    多态的理解
    ffmpeg处理RTMP流媒体的命令大全
  • 原文地址:https://www.cnblogs.com/james1207/p/3290267.html
Copyright © 2011-2022 走看看