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

Class IX IT notes: Part A, Unit 1, Session 3.

 IT notes class 9 Part A Unit 1: COMMUNICATION SKILLS session 3: VISUAL AND WRITTEN METHODS OF COMMUNICATION Q1. What is Visual Communicatio...