我有一个表单可以登录到一个网站,但不能登录到我的网站,我希望它们通过 HTML5 本地存储保存在我的网站中的表单数据。但不知道如何。任何想法?我的表格是这样的:
<form action="http://issuefy.ca.vu/on/login.php" class="form-login" method="post" />
<input name="email" type="email" id="email" required="" placeholder="Email" />
<input name="password" type="password" required="" placeholder="Contraseña" />
</form>
LocalStorage 有一个 setItem 方法。你可以这样使用它:
var inputEmail= document.getElementById("email");
localStorage.setItem("email", inputEmail.value);
当你想要获取该值时,可以执行以下操作:
var storedValue = localStorage.getItem("email");
还可以在单击按钮时存储值,如下所示:
<button onclick="store()" type="button">StoreEmail</button>
<script type="text/javascript">
function store(){
var inputEmail= document.getElementById("email");
localStorage.setItem("email", inputEmail.value);
}
</script>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)