html submit without submit button or JavaScript

后端 未结 3 1660
执笔经年
执笔经年 2020-12-20 09:39

Currently I have a simple form with a plus and minus on it and a value in the middle. I am trying to create a href link under the plus and under the minus to call self but t

相关标签:
3条回答
  • 2020-12-20 10:09

    You cannot submit an HTML form without using the button or input type=image/submit elements or JS.

    What you can do:

    1. Specify an image for input type=image
    2. Apply a bg image to input type=submit and killing the text via text-indent:-999em; for modern browsers and line-height for IE
    3. Split areas into separate forms if you really have to
    0 讨论(0)
  • 2020-12-20 10:13

    You won't be able to submit the form without either JavaScript or a submit button. The only exception would be if the user were to press enter in the textbox after changing the value. That should, in most browsers, submit the form. Besides that, JavaScript or a submit button is mandatory.

    0 讨论(0)
  • 2020-12-20 10:18

    Here's another way to gracefully degrade if the user doesn't have Javascript:

    -Code the form with a normal html submit button

    -Hide the button with Javascript (set the display to none)

    -submit the form when needed with Javascript.

    Thus, the negligable amount of users w/o javascript will simply have to click a button. Most of your users will never see it.

    Also, your code looks like it might be for paging or something similar. If so, you should also consider if it would be more appropriate to use a normal link with query parameters, and then use _GET rather than _POST. Thus, you wouldn't need a form submit.

    0 讨论(0)
提交回复
热议问题