Saturday, January 28, 2012

createTextNode() Method

The createTextNode() method creates a text node. This method returns a Text object.

JavaScript Code:
<script type="text/javascript" language="javascript">

    function CreateTextnodeFun() 
    {

        var CRTxtnode = document.createTextNode("Welcome in JavaScript!");
        document.body.appendChild(CRTxtnode);
    }
 
</script>

HTML Code:
<button onclick="this.CreateTxtnodeFun()">CreateTextNode</button>

No comments: