


Programs in JavaScript
9. removeChild example.
<html> <head> <script type="text/javascript"> function rem1() { d = document.getElementById("div1"); para = document.getElementById("msg"); d.removeChild(para); } </script> </head> <body> <input type="button" value="Rem" onclick="rem1()" /> <div id="div1"> <p id="msg">Welcome to all</p> <p>Hello to all</p> <p>Bye to all</p> </div> </body> </html>Output :
Welcome to all
Hello to all
Bye to all