关于input标签,密码输入保存的一些问题!
直接上代码不啰嗦!
<style>.input-box {
width: 210px;
height: 28px;
border-bottom: 1px solid #ccc;
text-indent: 6px;
font-size: 14px;
font-family: "微软雅黑";
line-height: 28px;
color: #ccc;
margin-top: 8px;
margin-left: 22px;
}</style>
<div class="intermediate_input_box">
<input type="text" id="mobile" name="mobile" class="input-box" value="请输入手机号或邮箱" onfocus="if(this.value=='请输入手机号或邮箱'){this.value=''};this.style.color='black';" onblur="if(this.value==''||this.value=='请输入手机号或邮箱'){this.value='请输入手机号或邮箱';this.style.color='#cccccc';}">
<input type="text" id="password_txt" class="input-box" value="密码" onclick="changetxt()">
<input type="password" id="password" class="input-box" onclick="changepassword()" style="display:none;" onfocus="if(this.value==''){this.value=''};this.style.color='black';" onblur="if(this.value==''||this.value==''){this.value='';this.style.color='#cccccc';}" >
</div>
<script type="text/javascript">
function changetxt()
{
objtxt=document.getElementById('password_txt');
objpassword=document.getElementById('password');
objtxt.style.display='none';
objpassword.style.display='';
objpassword.focus();
}
function changepassword()
{
objtxt=document.getElementById('password_txt');
objpassword=document.getElementById('password');
if(objpassword.value=='')
{
objtxt.style.display='';
objpassword.style.display='none';
objtxt.value='密码';
}
}
</script>
因为我这是采用点击事件获取后面的密码框,新手不太懂,因为自动保存密码了,第二次打开软件,一米已经保存但是由于时间没有触发,还是显示第一个状态,所以现在想在后台保存数据的同时可以直接显示密码框状态2,怎么写才可以实现。