Hack Forums
HTML button dir help - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Webmasters (https://hackforums.net/forumdisplay.php?fid=141)
+---- Forum: Website Construction (https://hackforums.net/forumdisplay.php?fid=50)
+---- Thread: HTML button dir help (/showthread.php?tid=5500941)



HTML button dir help - Jeffr3y - Dec 22, 2016

Ok so i want to make a button on my website that when you click it
it takes your to a diffrent html file E.x.
your on the website in index.html you click the button your get transfered to
test.html thank - Dat boi


* - ryan⚜ - Dec 22, 2016

Code
<FORM METHOD="link" ACTION="differentfile.html">
<INPUT TYPE="submit" VALUE="Button">
</FORM>



* - Bluffer - Dec 22, 2016

Couldn't you just add a href tag to the button element?


* - Jeffr3y - Dec 22, 2016

(Dec 22, 2016 12:36 AM)ryan⚜ Wrote:  
Code
<FORM METHOD="link" ACTION="differentfile.html">
<INPUT TYPE="submit" VALUE="Button">
</FORM>

Thank you


* - Rushax - Dec 22, 2016

Pretty sure it shouldn't be done like Ryan suggested as it's a form sending nothing to another page.
Same applies for the anchor around a button as its seen as very bad practice.

If you're using a framework like Bootstrap, there's really simple ways to make this happen by using:

Code
<a class="btn" href="link.html">Link</a>

If you're not using any frameworks, then you could just make your own styles for the element.


* - D3xus - Dec 22, 2016

(Dec 22, 2016 02:26 PM)Rushax Wrote:  Pretty sure it shouldn't be done like Ryan suggested as it's a form sending nothing to another page.
Same applies for the anchor around a button as its seen as very bad practice.

If you're using a framework like Bootstrap, there's really simple ways to make this happen by using:

Code
<a class="btn" href="link.html">Link</a>

If you're not using any frameworks, then you could just make your own styles for the element.
This. A form is not necessary. All you need is an anchor tag and some CSS to make it a button. If you're not using Bootstrap, it wouldn't be hard to wrap an anchor tag around the button.


* - PloxSource - Dec 23, 2016

Forms shouldn't be used for sending a user to another page for just a redirect. You only need a form if you're sending data through. Use an anchor tag like what the others have quoted above.


* - ryan⚜ - Dec 24, 2016

Whoaaaaa, seems a lot of hate is coming from this lol. Yes, it's better to do this as someone suggested.

<a class="btn" href="link.html">Link</a>

I posted that shit at 2am, relax people, you don't shoot the dude at burger king for accidentally putting onions on your burger..


* - Rushax - Dec 26, 2016

(Dec 24, 2016 03:55 PM)ryan⚜ Wrote:  Whoaaaaa, seems a lot of hate is coming from this lol. Yes, it's better to do this as someone suggested.

<a class="btn" href="link.html">Link</a>

I posted that shit at 2am, relax people, you don't shoot the dude at burger king for accidentally putting onions on your burger..
Not having a go at all lol, it's Xmas. Peace & love ✌

I think it's just better to say something so OP can know right okay, this works but its not really supposed to be done like this.

Happy Holidays 🤗


* - Jdxo - Dec 27, 2016

Im sure people reacted like that because that was a really obscure way to solve his problem lmao


* - ~Dec - Dec 27, 2016

(Dec 24, 2016 03:55 PM)ryan⚜ Wrote:  relax people, you don't shoot the dude at burger king for accidentally putting onions on your burger..

...I didn't get that memo


* - Jeffr3y - Jan 14, 2017

all dis over a post asking for halp? im so confused
lol


* - Nerdi - Jan 14, 2017

(Jan 14, 2017 12:50 AM)Jeffr3y Wrote:  all dis over a post asking for halp? im so confused
lol

They're offering you 2 ways to do it.
Best option:
Code
<a class="className" href="mylink.html">My Link</a>

and in the CSS...

Code
.className{
padding:10px;
color:white;
background-color:black;
text-align:center;
margin:20px;
}