HTML DOM renameNode() 方法

Document 对象参考手册 Document 对象

实例

重新命名 p 元素:

var p=document.getElementsByTagName("P")[0];
document.renameNode(p,null,"h1");

定义和用法

The renameNode() method renames nodes of type Element and Attr.


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

目前没有主流浏览器支持 renameNode() 方法。


语法

document.renameNode(node,namespaceURI,nodename)

参数

参数 类型 描述
node Node 对象 必须。需要重命名的节点对象。
namespaceURI String 必须, 如果你不想指定可以设置 namespace URI的节点可以设置为 null
nodename String Required, the new nodename

返回值

类型 描述
Node 对象 重命名节点

技术细节

DOM 版本 Core Level 3 Document 对象


Document 对象参考手册 Document 对象