11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

onclick="appendBefore('innerDiv',document.form1.field1.value);"<br />

/>><br />

<br />

<br />

<br />

<br />

<br />

Copying Nodes<br />

Sometimes you won‘t want to create and insert brand-new elements. Instead, you might<br />

use the cloneNode() method to make a copy of a particular node. <strong>The</strong> method takes a single<br />

Boolean argument indicating whether the copy should include all children of the node (called a<br />

deep clone) or just the element itself. An example demonstrating cloning and inserting nodes is<br />

presented here.<br />

<br />

<br />

<br />

Clone Demo<br />

<br />

<br />

<br />

This is a test of cloning<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!