How do I link two HTML pages with a button?

This question already has an answer here:

  • How to create an HTML button that acts like a link? 27 answers

  • Personally I would just change the button to a standard anchor. You could still style the link to make it look like a button.

    <a href="index.html">Go home</a>
    

    If the element really must remain a button, you could do this:

    <button onclick="location.href='index.html'>Go home</button>
    

    It's not exactly best practice, though.


    This will add a button and link it to the login page:

    <a href="path_to_login_page">
      <button>Take me to the login page</button>
    </a>
    

    Change path_to_login_page & Take me to the login page to customize the button. If you already have a customized button and want to use it:

    <a href="path_to_login_page">
      'Place your button here'
    </a>
    

    THIS IS THE SHORTEST AND THE FASTEST WAY TO DO IT:

    <a href="login-page.html">
    <button> Login Page</button>
    </a>
    

    Run and Check it here: https://jsfiddle.net/2zov6q2v/14/

    链接地址: http://www.djcxy.com/p/36554.html

    上一篇: 尝试使用HTML和CSS来点击按钮

    下一篇: 如何链接两个HTML页面和一个按钮?