'removeChild()' Example : removeChild : Javascript Methods : JavaScript Reference examples (example source code) Organized by topic

JavaScript Reference
C++
PHP


JavaScript Reference  »  Javascript Methods   » [  removeChild  ]   
 



'removeChild()' Example

    
<html>
<body>
<script language="JavaScript">
function function2() {
    var m = "New Element";
    var n = document.createElement("li");
    n.appendChild(document.createTextNode(m));
    document.getElementById("myList").appendChild(n)

function function2() {
    myList.removeChild(myList.lastChild);
}
</script>
<ul id="myList">
   <li>First list element</li>
   <li>Second list element</li>
</ul>
<input type="button" value="Add list item" onClick="function2();">
<input type="button" value="Remove added items" onClick="function2();">
</body>
</html>

    
      
      
Related examples in the same category
1.  'removeChild()' Syntax, Parameters and Note
2.  'removeChild()' is applied to
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.