<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>chenge password</title>
<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="cp.js"></script>
<style type="text/css">
#mainbody{margin:0 auto;width:40%;margin-top:80px}
.submit{margin:0 auto;margin-top:10px;width:20%}
p1{font-size:50px;font-family:inherit;text-align:center}
input{width:30px}
</style>
</head>
<body>
<div id="mainbody" class="form-group">
<p1>密码修改</p1>
<form id="form-horizontal">
<label >用户名</label><input type="text" class="form-control" id="username">
<div><b id="count">0个字符</b></div>
<p>请输入已经注册过的用户名。</p>
<label for="old-password">旧密码</label><input type="password" class="form-control" id="old-password">
<label for="n-password">新密码</label><input type="password" class="form-control" id="n-password">
<label for="new2-password">确认新密码</label><input type="password" class="form-control" id="new2-password">
<div class="submit"><button type="submit" class="btn btn-default" id="submit">确认修改</button></div>
</form>
</div>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
</div>
</body>
</html>
function getStrlength(str){
return str.replace(/[^\x00-xff]/g,"aa").length;
};
window.onload=function(){
var name=document.getElementById("username");
var name_msg=document.getElementsByTagName("p");
//var opassword=document.getElementById(old-password);
//var npassword=document.getElementById(n-password);
//var cnpassword=document.getElementById(new2-password);
var count=document.getElementById("count");
var name_length=0;
name.onfocus=function(){
name_msg.style.display = "block";
namemsg.innerHTML="请填写已经注册过的用名.";
};
name.onkeyup=function(){
count.style.visibility="visible";
name_length=getStrlength(this.value);
count.innerHTml=name_length+'个字符';
};
}
添加回答
举报
0/150
提交
取消