开发者

Why does the button value disappear from the submited form's query string in IE?

Here is the HTML of my form:

<form action="" method="get">
  <input name="name" type="text" value开发者_Go百科="a" id="a"/>
  <input name="password" type="text" value="b" id="b"/>        
  <input type="submit" name="c" value="submit" id="c"/>
</form>

If I hit the enter key when the focus is on the "name" textbox, the form will be submitted, and the query string will be ?name=a&password=b&c=submit. Notice that the value of the submit button is present in the query string.

However, if I remove the second textbox, and repeat the steps above, then the query string will be ?name=a; the button value has disappeared.

Is this behavior normal, or is it an IE issue?


Buttons aren't usually used to hold values. The only purpose of passing the value is when you have multiple submit buttons and you need to tell which one was actually pressed. Sometimes a form will have a "update" and "delete" buttons, for example. This is why they don't pass on a value if not pressed.


It's an IE issue. Search for: [internet explorer submit enter].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜