so_clearInnerHTML

Summary

A DOM based approach to clearing the contents of an object without setting its innerHTML property.

Arguments:

HTMLElement obj
The object who's HTML is to be cleared.

Usage:

so_clearInnerHTML(document.getElementById("caption"));

Examples:

This function is used to update the score and timer in Four Corners.

Code

function so_clearInnerHTML(obj) {
	while(obj.firstChild) obj.removeChild(obj.firstChild);
}

License

This code is issued under a Creative Commons license. You do not need my permission to use it, though I'm always interested in seeing where my code has ended up if you want to drop me a line.

slayeroffice main