Javascript examples for DOM HTML Element:Header
You can create a <header> element by using the document.createElement() method:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">create a HEADER element containing a h3 element with some text</button> <script> function myFunction() {/*from w w w . j av a 2 s . c o m*/ var x = document.createElement("HEADER"); x.setAttribute("id", "myHeader"); document.body.appendChild(x); var y = document.createElement("H3"); var t = document.createTextNode("This is a h3 element in a header element"); y.appendChild(t); document.getElementById("myHeader").appendChild(y); } </script> </body> </html>