<table class="login_table"><tr><td>账号</td><td><input type="text" value="请输入您的账号" class="admin" /></td></tr><tr><td>密码</td><td><input type="text" value="请输入您的密码"id="login_showPwd" /><input type="password"id="login_password" style="display: none"/></td></tr><tr><td><input type="button" value="登录" /><input type="button" value="重置" id ="btn_res"/></td></tr></table>然后上js部分
//账号部分$(function(){$(".admin").focus(function(){if($(this).val() == "请输入您的账号"){$(this).val("");}});$(".admin").blur(function(){if($(this).val() == ""){$(this).val("请输入您的账号");}});// 密码部分$("#login_showPwd").focus(function(){var text_value=$(this).val();if(text_value == this.defaultValue){$("#login_showPwd").hide();$("#login_password").show().focus();}});$("#login_password").blur(function(){var text_value = $(this).val();if(text_value==""){$("#login_showPwd").show();$("#login_password").hide();}});//重置部分$("#btn_res").click(function(){$(".admin").val("请输入您的账号");$("#login_password").hide().val("");$("#login_showPwd").show();});});下面给大家介绍密码输入框 底下显示的文字方法<input type="password" name="pas" placeholder="密码"/>加了一个placeholder属性就好了

以上所述是小编给大家介绍的实现密码框(password)中显示文字提示功能代码的相关知识,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!