×

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

作者:Terry2017.02.02来源:Web前端之家浏览:9728评论:0
关键词:JQueryJS

复制代码 代码如下:

<html>
<head>
<script type="text/javascript" src="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 id="passwd" type="password"
size="24" maxlength="17"
style="ime-mode: disabled; display: inline;"/>
<input id="passwd2" type="text"
size="24" maxlength="17"
style="ime-mode: disabled; display: none;" />
<input id="chk" type="checkbox" />显示密码
</form>
</body>
</html>

您的支持是我们创作的动力!
温馨提示:本文作者系Terry ,经Web前端之家编辑修改或补充,转载请注明出处和本文链接:
https://www.jiangweishan.com/article/svg1485964800707.html

网友评论文明上网理性发言已有0人参与

发表评论: