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

Sacred Thought

28 April 2024 Today I am going to explain verse 31 - 38 chapter two for you all. There is no opportunity better than a righteous war (सत्य औ...