1var elem = document.createElement('div');
2elem.style.cssText = 'position:absolute;width:100%;height:100%;opacity:0.3;z-index:100;background:#000';
3document.body.appendChild(elem);
1// In the JS script
2
3var parElement = document.getElementById("myPar");
4var textToAdd = document.createTextNode("Text to be added");
5parElement.appendChild(textToAdd);
6
7//In the HTML file
8
9<p id="myPar"></p>
1document.getElementById("p").textContent += " This is the text from javascript.";
2
3<p id ="p">This is the text from HTML.</p>