Well it all depends, in the example you have provided you cant do that, you can only do that when you call a function that also returns a function a good example is jQuery, lets take a look.
$('#something') // <-- select a element - returns a whole object of functions
.hide() // hide function was returned
.show() // show function was returned
.css(...);
In your example the string that you set was actually returned.
This is how you make a chaining function.
var test = function( name ) {
this.name = name;
return this;
};
test.prototype.viewName = function() {
console.log(this.name);
};
test.prototype.showName = function() {
alert(this.name);
return this;
};
var john = new test('john');
john.showName().viewName();
So in your case you would have to store the object
var element = document.getElementById("ID");
element.innerHTML = "Something";
element.style.display = "some";
element.style.color = "#CCC";
So it all depends on what is returned from your last action.