博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
模仿支付宝支付密码框思路
阅读量:6860 次
发布时间:2019-06-26

本文共 1577 字,大约阅读时间需要 5 分钟。

hot3.png

<style> input[type="password"] { width: 50px; text-align: center; font-size: 24px; font-weight: bold; border-radius: 1px; padding: 8px 0px; border: 1px solid #cccccc; } </style>

<div id="password-content" class="input"> <input type="password" maxlength="1" value="" disabled/><input type="password" maxlength="1" value="" disabled/><input type="password" maxlength="1" value="" disabled/><input type="password" maxlength="1" value="" disabled/><input type="password" maxlength="1" value="" disabled/><input type="password" maxlength="1" value="" disabled /> </div> <script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $("#password-content").click(function(){ console.log('#password-content'); var oInput = $(".input input"); oInput.attr('disabled'); for(var i=0;i<oInput.length;i++) { if(oInput[i].value == '') { oInput[i].disabled=''; oInput[i].focus(); break; } if(i==5) { oInput[i].removeAttribute("disabled"); oInput[i].focus(); } } document.getElementById("password-content").addEventListener('keyup',myFunction); }); });

function myFunction() {

var oInput = $(".input input");	oInput.attr('disabled','disabled');if(event.keyCode == 8){	for(var i=oInput.length-1;i>=0;i--)	{		if(oInput[i].value != '')		{			oInput[i].removeAttribute("disabled");			oInput[i].focus();			break;		}		if(i==0)		{			oInput[i].removeAttribute("disabled");			oInput[i].focus();			break;		}	}}else if(event.keyCode != 8 && event.keyCode >= 0){	for(var i=0;i

} </script>

转载于:https://my.oschina.net/u/2292141/blog/750917

你可能感兴趣的文章
阿里云ECS通过docker配置MySQL--MGR
查看>>
光伏业需要一次国内“双反”
查看>>
小微企业都在用的一体化管理解决方案
查看>>
Sql Server 2008 为开发带来的新特性
查看>>
Realm为Node.js发布对象数据库
查看>>
农民别再愁!人工智能帮你诊断作物疾病
查看>>
物联网行业将掀起新一轮并购潮 步入整合期
查看>>
夏日炎炎 构筑安防线 这些知识你Get到了吗?
查看>>
《C语言程序设计:问题与求解方法》——2.4节C语言源程序的次要组成成分:编译预处理命令、注释和声明...
查看>>
业绩不佳引裁员 雅虎2016有点烦
查看>>
《Hadoop实战第2版》——导读
查看>>
德国为新能源付出了哪些巨大的代价?
查看>>
探讨医疗人工智能之眼科AI的真实应用场景(肽积木CEO柏文洁)丨硬创公开课...
查看>>
中冶集团首度亮相智博会 探索“智慧城市的智慧地下”
查看>>
大数据认知:军事后勤变革的新引擎
查看>>
荷兰Serverius数据中心如何逆袭运营困境
查看>>
思科:6成物联网计划仍处于概念验证阶段
查看>>
物联网普及率目前第一是韩国
查看>>
远离个人信息裸奔伤害
查看>>
智慧城市如何应对洪灾?
查看>>