I've abstracted a few methods, which could make them a little more useful for multiple invocations:
var el = document.getElementById("MonitorInformation");
function text( el, str ) {
if ( el.textContent ) {
el.textContent = str;
} else {
el.innerText = str;
}
}
function size ( el, str ) {
el.style.fontSize = str;
}
function color ( el, str ) {
el.style.color = str;
}
size( el, '11px')
color( el, 'red' )
text(el, 'Hello World')
Note: The best practice to dynamically change this type of stuff would be by setting the styles in a seperate external selector:
.message { color:red; font-size:1.1em; }
And toggling the class name, .className+= 'message' ( or an abstracted function to add/remove classes ).