jquery 实现密码框的显示与隐藏示例代码

lxf2023-05-10 06:49:01
摘要

密码框的显示隐藏有多种实现方法,在将为大家介绍如何使用jquery实现,感兴趣的朋友可以参考下


<html>
<head>
<script type="text/javascript" keylink">Jquery-1.5.1.min.js"></script>
<script type="text/javascript">
$(function(){
$("#chk").bind({
click: function(){
if($(this).attr("checked")){
$("#passwd2").val($("#passwd").val());
$("#passwd").hide();
$("#passwd2").show();
}else{
$("#passwd").val($("#passwd2").val());
$("#passwd2").hide();
$("#passwd").show();
}
}
});
});
</script>
</head>
<body>
<fORM name="formName">
<input type="passWord"
size="24" maxlength="17"
style="ime-mode: disabled; display: inline;"/>
<input type="text"
size="24" maxlength="17"
style="ime-mode: disabled; display: none;" />
<input type="checkbox" />显示密码
</form>
</body>
</html>