This is a fairly simple three stage process:
- create the new element
- set any properties of the new element
- append it as a child to an existing element
The code to do this would look like this:
var newElement=document.createElement('p');
newElement.textContent='Hi';
document.body.appendChild(newElement);
That:
- creates an element in a variable called newElement
- adds textContent (remember that doesn't work in IE so you really need an IF here)
- appends the new element to the BODY (it will appear at the end of what is already there)
Try it by creating a suitably named function triggered by ONMOUSEDOWN in the BODY or a clickable piece of text. Then try to adapt it for IE by using an IF statement to find out what properties the browser supports.



