document.body.appendchild
to append an element as child element in the current document
<script>
function fun1()
{
var con=document.create Element("input")
con.type="button"
con.value="enter name'
con.style.color="green"
con.onclick=fun2()
document.body.appendchild(con)
con1=document.createElement("div")
con1.innerHTML="this is div"
document .body.appendchild(con1)
}
function fun2()
{
alert("button is checked");
}
</script>
<input type="button" value="click" onclick="fun1()".
to append an element as child element in the current document
<script>
function fun1()
{
var con=document.create Element("input")
con.type="button"
con.value="enter name'
con.style.color="green"
con.onclick=fun2()
document.body.appendchild(con)
con1=document.createElement("div")
con1.innerHTML="this is div"
document .body.appendchild(con1)
}
function fun2()
{
alert("button is checked");
}
</script>
<input type="button" value="click" onclick="fun1()".