[英]how to redirect page after validation
how to redirect page after validation here is my code:验证后如何重定向页面是我的代码:
function checkSubmit(){ function checkSubmit(){
var nameValue = localStorage.getItem("username");
var passValue = localStorage.getItem("psw");
var gendreValue=localStorage.getItem("check");
var nameInput= document.getElementById("username");
var passInput= document.getElementById("psw");
if(nameInput.value == nameValue && passInput.value == passValue) {
//alert('You are loged in successfully.');
window.location.replace("quiz.html");
}else {
alert('Please enter valid name and password');
}
} }
If you want to redirect to webpages use: window.location.href = "quiz.html";
如果要重定向到网页,请使用:
window.location.href = "quiz.html";
(that is for javascript) (那是为javascript)
For example in your html page put: <script> window.location.href = "quiz.html"; </script>
例如在您的 html 页面中输入:
<script> window.location.href = "quiz.html"; </script>
<script> window.location.href = "quiz.html"; </script>
For the html code use: <meta http-equiv="refresh" content="time; URL=quiz.html" />
对于 html 代码使用:
<meta http-equiv="refresh" content="time; URL=quiz.html" />
Replace quiz.html
with the page or website you want it to redirect you to.将
quiz.html
替换为您希望它重定向到的页面或网站。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.