Write a JavaScript program to create element and textnode.
<html>
<head>
<style>
#msg {
width: 200px;
height: 200px;
background-color:cyan;
}
</style>
<script type="text/javascript">
var count = 1;
function fun() {
var d = document.getElementById("msg");
var e = document.createElement("p");
var txt = document.createTextNode("TextNode " + count);
e.appendChild(txt);
d.appendChild(e);
count++;
}
</script>
</head>
<body>
<input type="button" value="Add" onclick="fun()" />
<div id="msg">
</div>
</body>
</html>
