Monday, February 26, 2018

javaScript : Adding an HTML element to your webpage

<html>
<body id="b1">


<p id="a">webmakers.com</p>
<script>
function f1()
{

var newH=document.createElement("h1");
var node=document.createTextNode("Yash Singh");
newH.appendChild(node);
var body=document.getElementById("b1");
body.appendChild(newH);

}
</script>

<button type="button" onclick="f1()">Adds Header Element to body</button>

Thanks
Happy programming!

1 comment:


  1. I’m glad to see it featured here,Nice blog, I really apprecialte the way you are sharing your experiences,Thank you for sharing about this information. That’s nice and interesting, I like it. IGNOU Courses
    IGNOU Study Material
    IGNOU Syllabus
    IGNOU Assignments
     IGNOU Study Center
    IGNOU MBA Study Material

    ReplyDelete

How can I run a C++ program directly from Windows?

How-can-I-run-a-C-program-directly-from-Windows