Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Form tags on input buttons?

    Is it necessary (or advisable) to place <form> tags around input buttons? They seem to work fine either way.

    Code:
    <input type="button" value="  Home  " onClick="parent.main.location='home.htm'">

  • #2
    Regular Coder
    Join Date
    Feb 2010
    Posts
    104
    Thanks
    5
    Thanked 3 Times in 3 Posts
    Don't worry about the form tag. You only need to use it when submitting data to another page with POST or GET.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,664
    Thanks
    80
    Thanked 4,641 Times in 4,603 Posts
    Some older browsers (Nescape 4, I remember) would not show a form field if it did not have <form>...</form> around it.

    I don't know if any modern browsers have the same limitation.

    But what harm does it do to use <form>...</form>???

    You could just use one <form> at the top of the page and one </form> at the bottom of the page.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    New Coder
    Join Date
    Jun 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Just cleaning up some code. Found I'd been using it both ways, without any problems, and wondered which was strictly correct.

    Thanks.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •