I improved the code, and now I understand that functions are first-class objects, so any object name is also a reference to it. and this name can be passed to other functions in the parameters by simply dropping the brackets around the name.
function change_text(to, id, func) {
this.to = to;
this.id = id;
this.doit = function() {
this.target = document.getElementById(this.id);
this.target.innerHTML = this.to;
}
this.func = func;
}
function testx() {
alert("TESTING");
}
var box = new change_text("HELLO, WORLD", 'theboxtochange', testx());
box.func()
, .