直播平台源代码,html网站使用js实现记住账号密码功能
1、保存账号密码
<script type="text/javascript">
var username = $("input[name='username']").val();
var password = $("input[name='password']").val();
localStorage.setItem("username",username);
localStorage.setItem("password",password);
</script>
2、读取保存在localStorage里的账号密码
<script type="text/javascript">
$(function(){
var username = localStorage.getItem("username");
var password = localStorage.getItem("password");
if(username!=null&&username!=undefined&&username!=""){
$("input[name='username']").val(username);
$("input[name='password']").val(password);
}
});
</script>
3、移除已经保存的账号密码
<script type="text/javascript">
localStorage.removeItem("username");
localStorage.removeItem("password");
</script>
以上就是 直播平台源代码,html网站使用js实现记住账号密码功能,更多内容欢迎关注之后的文章
标签:username,源代码,val,js,html,localStorage,password,账号密码 From: https://www.cnblogs.com/yunbaomengnan/p/16850878.html