手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >密码框显示提示文字jquery示例
密码框显示提示文字jquery示例
摘要:复制代码代码如下:登录$(document).ready(function(){$(".text_login").focus(functio...

复制代码 代码如下:

<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" border="0">

<tr>

<td> 账号:</td>

<td>

<input type="text" name="uname" value="user name" id="uname"/>

</td>

</tr>

<tr>

<td> 密码:</td>

<td>

<input type="text" value="password" id="password1"/>

<input type="password" id="password2"/>

</td>

</tr>

</table>

</body>

</html>

【密码框显示提示文字jquery示例】相关文章:

体验jQuery和AngularJS的不同点及AngularJS的迷人之处

漂亮的仿flash菜单,来自蓝色经典

javasript实现密码的隐藏与显示

JS中的THIS和WINDOW.EVENT.SRCELEMENT详解

动态提示的下拉框

图片按比例缩放函数

Node.js实现JS文件合并小工具

JavaScript实现广告的关闭与显示效果实例

JavaScript中用getDate()方法返回指定日期的教程

接收键盘指令的脚本

精品推荐
分类导航