5

I've got two HTML pages, with one being an opening page for an application and the second being a login page. I have a button on the opening page and I want to be able to click on it and have it take me to the login page. How do I do this?

Corbin Smith
  • 59
  • 1
  • 1
  • 2

3 Answers3

3

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>
nextstep
  • 1,399
  • 3
  • 11
  • 26
2

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.

kieranpotts
  • 1,510
  • 11
  • 8
2

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/

buggytuf
  • 69
  • 1
  • 10