How to make a button that goes to a link if you right click on it

I made a button using the element. I want to make it so when you right click on it, it goes to another html page. Please help!

There are a few ways to do this.

CSS Button

<!-- you style an <a> tag as a button -->
<a href="/pog.html">Link to another page!</a>

...

<style>
/* You can customize these styles however you want, the point is to make it look like a button */

a {
  background-color: blue;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
}

</style>

Illegal (but functional) code based on HTML5 standards

<a href="/more_pog.html">
  <button>More links!</button>
</a>  

Highly Unorthodox Method

<form style="display: inline" action="/pog.html" method="get">
  <button>Too many links!</button>
</form>

The JavaScript Way

<button onclick="window.location.href = '/pog.html'">Now I hate links!</button>

Hope this helps.

1 Like

It made the button but I want it to go to a page when you right click on it and does nothing when you left click on it

Ok I definitely read the initial post wrong.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.