简体   繁体   English

在页面之间移动html

[英]Moving between pages html

i am trying to use the window.location js to redirect user when they click the submit button but when i test run the website, clicking the button did not work 我正在尝试使用window.location js来重定向用户,方法是单击用户的“提交”按钮,但是当我测试运行网站时,单击该按钮不起作用

           <input type="email" id="Email" name="Email" placeholder="Email" onblur="checkRequired(this)" onfocus="checkRequired(this)" >

            <input type="password" id="Password" name="Password" placeholder="Password" onblur="checkRequired(this)" onfocus="checkRequired(this)"  >

            <input type="submit" value="Login" onclick="return check();">
        <script>check()
        {
            window.location.href = 'page5.html';
        }
        </script>

Solved: Your syntax is wrong ,your function declaration is not correct ,function is missing ,change it like below 解决:您的语法错误,您的函数声明不正确,函数丢失,如下更改

<script>
function check()
        {
            window.location.href = 'page5.html';
        }
</script>

Try putting "function" before your function 尝试将“功能”放在功能之前

<script>
function check()
{
window.location.href = 'page5.html';
}
</script>

You have to put keyword "function" before check() in your code so browser understands check() is a javaScript function. 您必须在代码中的check()之前放置关键字“ function”,以便浏览器理解check()是javaScript函数。 Only then it will call it. 只有这样,它才会调用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM