ColdFusion:HTML <Button> 标签在 IE 11 和其他浏览器中设置 FORM 范围值的方式不同

ColdFusion: HTML <Button> tag sets FORM scope value differently in IE 11 vs other browsers

在下面的代码示例中...


<CFOUTPUT>

    <cfdump var=#FORM#> 

    <FORM NAME="LAYOUTFORM" ACTION="" id="TEST_FORM" METHOD=POST>

        <BR> <BR> <BR> 

        <div class="div">
            <button  type="submit" form="TEST_FORM" name="test" type="submit" value="BUTTON-VALUE" >  THIS IS NOT THE VALUE YOU WERE HOPING FOR</button>
        </div>
    </FORM>

</CFOUTPUT>

点击按钮并提交 post 请求后...
Google ChromeMozilla FirefoxMicrosoft Edge 我收到了转储 FORM 范围后的预期结果

[FieldNames | Test] 
[Test       | Button-Value]

提交后点击 Internet Explorer 11 我收到不同的结果

[FieldNames | Test                                      ] 
[Test       | THIS IS NOT THE VALUE YOU WERE HOPING FOR ]

IE 11 似乎没有使用 value,而是提交 <BUTTON> 标签之间的内容

我在 https://www.w3schools.com/TAGS/att_button_value.asp

上找到了一条注释

Note: If you use the element in an HTML form, Internet Explorer, prior version 8, will submit the text between the and tags, while the other browsers will submit the content of the value attribute.

这似乎是相同的行为,但我使用的是 IE 11....
我还尝试了试用示例,并且在提交到时使用按钮提交了正确的值action_page.php


  1. 如果目标是 ColdFusion 页面,有人知道为什么 IE-11 提交时就好像它是 IE-8 一样吗? (我没有接触过 IE 兼容性设置)

  2. 除了使 value<Button> 标签之间的内容相同之外,还有其他解决方案吗?

  1. 可能是X-UA-Compatibleheader。或者 IE 根据它在页面中看到的内容表现得很古怪。

  2. 不使用 button 来传递表单变量,而是使用 <input type="hidden" name="abc" value="xyz">。按钮是用来执行操作的。输入用于保存值。