我有一些使用登录表单的代码,我需要在div中引用一个javascript变量。这是HTML。
<div class="div"
variable="Variable Here?"
</div>
这是JavaScript。
function setLoginFormVars(form) {
localStorage.setItem('email', email = document.getElementById("email").value);
localStorage.setItem('apikey', apikey = document.getElementById("apikey").value);
window.location.href = 'miner.html';
}
javascript位于表单所在的文件中。单击登录按钮后,将运行功能setLoginFormVars
。
我如何指定它是一个变量,甚至有可能做我要问的事情。
谢谢。
Nyle