简体   繁体   中英

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

           <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. Only then it will call it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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