Using javascript to set InnerText in Firefox and IE
Internet Explorer has a nice property .innerText which sets non-HTML contents inside an HTML container. Firefox does not have this function. I found a solution that looks like this:
function UpdatePreview(sourceControl, destinationContainer)
{
if (destinationContainer.firstChild)
{
// if we have a child item, overwrite it
destinationContainer.firstChild.nodeValue =
sourceControl.value;
}
else
{
//create a new text child item
destinationContainer.appendChild(document.createTextNode(
sourceControl.value));
}
}
UPDATE: Of course you can always use the lovely jQuery library to do this and much, much, much, more!.