首页 > Web开发 > 详细

用JS实现的类似QQ密码的输入特效

时间:2015-04-04 13:32:19      阅读:296      评论:0      收藏:0      [点我收藏+]
<input ID="_PSD"></input>
<script>
function passwordText(ID,pd,mark){
mark=mark||"*"
var PSD=document.getElementById(ID)
var password=pd
var lh=PSD.value.length
setInterval(function(){
if(PSD.value.length!=lh){
if(PSD.value.length>lh)run(1)
else run(0)
lh=PSD.value.length
}
},1)
function run(n){
switch(n){
case 0:
password.length-=1
break
case 1:
password.push(PSD.value.charAt(PSD.value.length-1))
break
}
PSD.value=""
for(var i=0;i<password.length-1;i++)
PSD.value+=mark
if(password.length)
PSD.value+=password[password.length-1]
}
}
var password=[]
passwordText("_PSD",password,"*")
</script>

  

用JS实现的类似QQ密码的输入特效

原文:http://www.cnblogs.com/zckpdln/p/4392003.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!