domnode.replacechild.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 169 行

HTML
169
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Replaces a child</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="class.domnode.html">DOMNode</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.domnodelist.html">DOMNodeList</a></div> <div class="up"><a href="class.domnode.html">DOMNode</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="domnode.replacechild" class="refentry"> <div class="refnamediv">  <h1 class="refname">DOMNode::replaceChild</h1>  <p class="verinfo">(No version information available, might be only in CVS)</p><p class="refpurpose"><span class="refname">DOMNode::replaceChild</span> &mdash; <span class="dc-title">   Replaces a child  </span></p> </div> <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <span class="methodname"><b><b>DOMNode::replaceChild</b></b></span>    ( <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <tt class="parameter">$newnode</tt></span>   , <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <tt class="parameter">$oldnode</tt></span>   )</div>  <p class="para rdfs-comment">   This function replaces the child <i><tt class="parameter">oldnode</tt></i>    with the passed new node. If the new node is already a child it    will not be added a second time. If the replacement succeeds the    old node is returned.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">newnode</tt></i></span>     <dd>      <p class="para">       The new node. It must be a member of the target document, i.e.       created by one of the DOMDocument-&gt;createXXX() methods or imported in       the document by <a href="domdocument.importnode.html" class="xref">DOMDocument::importNode</a>.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">oldnode</tt></i></span>     <dd>      <p class="para">       The old node.      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   The old node or <b><tt>FALSE</tt></b> if an error occur.  </p> </div> <div class="refsect1 errors">  <h3 class="title">Errors/Exceptions</h3>  <p class="para">   <dl>    <dt>     <span class="term"><b><tt>DOM_NO_MODIFICATION_ALLOWED_ERR</tt></b></span>     <dd>      <p class="para">       Raised if this node is readonly or if the previous parent of the node       being inserted is readonly.      </p>     </dd>    </dt>    <dt>     <span class="term"><b><tt>DOM_HIERARCHY_REQUEST_ERR</tt></b></span>     <dd>      <p class="para">       Raised if this node is of a type that does not allow children of the        type of the <i><tt class="parameter">newnode</tt></i> node, or if the node to        put in is one of this node&#039;s ancestors or this node itself.      </p>     </dd>    </dt>    <dt>     <span class="term"><b><tt>DOM_WRONG_DOCUMENT_ERR</tt></b></span>     <dd>      <p class="para">       Raised if <i><tt class="parameter">newnode</tt></i> was created from a different        document than the one that created this node.      </p>     </dd>    </dt>    <dt>     <span class="term"><b><tt>DOM_NOT_FOUND</tt></b></span>     <dd>      <p class="para">       Raised if <i><tt class="parameter">oldnode</tt></i> is not a child of this node.      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="domnode.appendchild.html" class="xref">DOMNode::appendChild</a></li>    <li class="member"><a href="domnode.removechild.html" class="xref">DOMNode::removeChild</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="class.domnode.html">DOMNode</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.domnodelist.html">DOMNodeList</a></div> <div class="up"><a href="class.domnode.html">DOMNode</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?