展厅效果图网站,嘉兴建设企业网站,佛山市做网站,wordpress托管在哪里replaceChild 实现子节点(对象)的替换。返回被替换对象的引用。 语法#xff1a; node.replaceChild (newnode,oldnew ) 参数#xff1a; newnode : 必需#xff0c;用于替换 oldnew 的对象。 oldnew : 必需#xff0c;被 newnode 替换的对象。 注意: 1. 当 oldnode 被替…replaceChild 实现子节点(对象)的替换。返回被替换对象的引用。 语法 node.replaceChild (newnode,oldnew ) 参数 newnode : 必需用于替换 oldnew 的对象。 oldnew : 必需被 newnode 替换的对象。 注意: 1. 当 oldnode 被替换时所有与之相关的属性内容都将被移除。 2. newnode 必须先被建立。 !DOCTYPE HTML
html
head
meta http-equivContent-Type contenttext/html; charsetutf-8
title无标题文档/title
/head
bodydivb idoldnodeJavaScript/b是一个很常用的技术为网页添加动态效果。/diva hrefjavascript:replaceMessage() 将加粗改为斜体/ascript typetext/javascriptfunction replaceMessage(){var inode document.createElement(i);var itext document.createTextNode(JavaScript);inode.appendChild(itext);var oldnode document.getElementById(oldnode);oldnode.parentNode.replaceChild(inode,oldnode);}/script/body
/html 转载于:https://www.cnblogs.com/sunxirui00/p/7504104.html