So I just put a button and I don't know how to assign things to it. I mean like I click the button the another link is opened.
My button code
<input type="button" value="anything">
So I just put a button and I don't know how to assign things to it. I mean like I click the button the another link is opened.
My button code
<input type="button" value="anything">
If you want to simply make a button link to another website/ page, here you go:
<button onclick="location.href='link_goes_here'" type="button">
Button_Text_Here</button>
note the different quotation marks being used :)
edit:
<input type="button" onclick="location.href='link_goes_here'" value="button_text>
you can use something like an <a href="the_url_where_to_go">text</a>
then you format it with css like
a {
display:block;
width: 100px;
height: 30px;
background-color: #ccc;
border-radius: 5px;
}
otherwise you can use the button with javascript
<button onclick="location.href='the_url_where_to_go'" type="button">
Button_Text_Here</button>
or
<input type="button" onclick="location.href='the_url_where_to_go'" value="text_of_the button">
Do this:
<button onclick="window.open('https://example.com')">Button</button>
You can either do
<input type="button" value="Anything" onclick="window.location='http://www.example.org'" />
or
<a href="http://www.example.org"><button>Anything</button></a>
You can just use the <a>
tag with a button inside. very simple.
<a href="http://www.stackoverflow.com"><button>Click this link</button></a>