setAttribute第三个参数

object.setAttribute(sName, vValue [, iFlags])

  sName参数应是Dom属性而非html中的属性。Dom中Html专有的接口属性应该以小写字母开头,如果属性有多个单词构成,第二个单词以及接下来的每个单词的首字母都要大写,如frameBorder

另外说一下iflags参数:

iFlags Optional. Integer that specifies one the following flags:

0 When the attribute is set, it overwrites any attributes with the same name, regardless of their case.
1 Default. The case of the attribute that you set is respected when it is set on the object.

0:覆盖任何同名属性(忽略大小写)
1:默认,覆盖已经被设定的属性值
  上面的问题我也可以setAttribute(‘frameborder’ , '0' , 0)实现。

原文地址:https://www.cnblogs.com/lhgstudio/p/3314451.html