Re: How can I DomDocument->renameNode?

From: Date: Tue, 05 Jun 2007 17:45:47 +0000
Subject: Re: How can I DomDocument->renameNode?
Groups: php.general 
Request: Send a blank email to php-general+get-256110@lists.php.net to get a copy of this message
Thanks for the reply, but the solution needs to be in PHP, not JavaScript. -----Original Message----- From: tedd [mailto:tedd@sperling.com] Sent: Sunday, June 03, 2007 3:20 PM To: php-general@lists.php.net Subject: [PHP] Re: How can I DomDocument->renameNode? >I have tried making a new node, inserting it before the old node then >removing the old node but I could not figure out how to get the >nodeValue to include the child nodes, so they get stripped out leaving >only the text value. You might try something like this: function replaceNode() { var inChoice = document.getElementById("grafCount").selectedIndex; var inText = document.getElementById("textArea").value; var newText = document.createTextNode(inText); var newGraf = document.createElement("p"); newGraf.appendChild(newText); var allGrafs = nodeChangingArea.getElementsByTagName("p"); var oldGraf = allGrafs.item(inChoice); nodeChangingArea.replaceChild(newGraf,oldGraf); } tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#256110) next »