zoukankan      html  css  js  c++  java
  • IE的button元素bug

    button元素在过去一直没有被重视,其实它比<input type="button">的语义强许多,制定性也好许多。不过IE的button元素存在一个可怕的bug。它总是把其innerHTML神经错乱地当成其value值,因此,如果用它来提交表单时,可能产生一些负作用,会把正确的键值对覆盖了。

    这恶性bug即使是jQuery1.3.2也没有修正它,因此不要迷信jQuery。不过,这bug也不是那么难修正的。如果光是想获得正确的value值,我们可以简单地使用如下代码:

    var el = document.getElementById("bb");
    el.attributes["value"].nodeValue
    

    如果是提交表单时,就有点麻烦了。为了对比效果,我把错误的提交也做成例子了。留意以下运行框,点击按钮后如果地址栏的location search是nasami=correct_submit,说明提交成功,如果是nasami=error_submit,说明提交了错误的值了。

    加上修正脚本之后……

  • 相关阅读:
    lecture 11.4
    lecture 10.30
    boolean functions and beyon
    lecture10.21
    golang hex to string
    golang中 将string转化为json
    ubuntu16报错: add-apt-repository command not found
    ubuntu16的防火墙关闭
    ubuntu 16 解决错误 manpath: can't set the locale; make sure $LC_* and $LANG are correct
    go get 安装时报 (https fetch: Get https://golang.org/x/crypto/acme/autocert?go-get=1: dial tcp 220.255.2.153:443: i/o timeout)
  • 原文地址:https://www.cnblogs.com/rubylouvre/p/1617976.html
Copyright © 2011-2022 走看看