我有以下页面:
<!doctype html>
<html lang="en" class="darkBlue">
<head>
</head>
<body>
@RenderSection("Content")
<div class="loading-mask" id="loading-mask" style="display: none;">
<span>Authenticating ...</span>
</div>
<script type="text/javascript">
(function() {
document.getElementsByClassName('form')
.addEventListener("submit", function () {
alert("hi");
document.getElementById("loading-mask").style.display = "block";
}, false);
})();
</script>
</body>
</html>
和这个部分页面:
@{ Layout = "~/Views/Account/Layout.cshtml"; }
@section content {
<form action="/Account/Login" class="form" method="post">
<button type="submit" class="glossy">Login</button>
</form>
}
我希望在按下提交时加载掩码 div 变得可见。然而,这似乎并没有发生。这可能是因为我的部分尚未加载吗?谁能给我一些建议,我如何才能使这项工作?