XML DOM createAttribute() 方法

Document 对象参考手册

定义和用法

创建新的 Attr 节点。

语法:

createAttribute(name)
参数 描述
name 新创建的属性的名称。
本在线速查手册由www.w〖〗3〖〗x〖〗u〖〗e.com提供,请勿盗用!

抛出

如果 name 参数中含有不合法的字符,该方法将抛出代码为 INVALID_CHARACTER_ERR 的 DOMException 异常

参阅

Element.setAttribute()Element.setAttributeNode()

Document 对象参考手册