Sunday, 13 December 2015

Create Button at Run time on button click by Java Script

Create Button at Run time on button click by Java Script

Source Code :-

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <p> Click the button to make a BUTTON element with text.</p>
    <button onclick="myFunction()">
        Try it</button>
    <script type="text/javascript">
        function myFunction() {
            var btn = document.createElement("BUTTON");
            var btn1 = document.createTextNode("CLICK Here");
            btn.appendChild(btn1);
            document.body.appendChild(btn);
        }
    </script>
</body>
</html>

OutPut :-















No comments:

Post a Comment

Factorial of a Number

Recently Viewed