【问题标题】:Can't get value of a button using Page.Request.Form[i]无法使用 Page.Request.Form[i] 获取按钮的值
【发布时间】:2009-09-30 10:08:56
【问题描述】:

我的 html 看起来是这样的:

<button type="submit" class="img" name="save" value="0">Speichern</button>
<button type="submit" class="img" name="save" value="1">Speichern und Schließen</button>**

当我使用 Page.Request.Form[i] 解析请求时,键“save”的值是“Speichern und Schließen”而不是 1,我看不到任何获得正确值的可能性。有没有办法获得正确的值(0 或 1 而不是“Speichern und Schließen”)?

【问题讨论】:

  • 您使用的是哪个浏览器(名称、版本)?

标签: c# html forms post


【解决方案1】:

标签定义了一个按钮。

您可以在按钮元素内放置内容,例如文本或图像。这是此元素与使用 input 元素创建的按钮之间的区别。

始终指定按钮的类型属性。 Internet Explorer 的默认类型是“按钮”,而在其他浏览器(以及 W3C 规范中)它是“提交”。

http://www.w3schools.com/tags/tag_button.asp

【讨论】:

    猜你喜欢
    • 2019-10-05
    • 2015-09-27
    • 2021-07-10
    • 1970-01-01
    • 2013-06-14
    • 1970-01-01
    • 1970-01-01
    • 2020-07-14
    • 2016-01-03
    相关资源
    最近更新 更多