You can't call killSwitch because you defined the method as a property of the object instance (this.killSwitch).
You can't use this inside the keypress event, because it will refer to the document, you have to store the this value:
var ClassA = function() {
var doc = document,
instance = this; // store reference to `this`
doc.onkeypress = function(e){ instance.killSwitch(); };
this.killSwitch = function(){ alert('hello world'); };
}
var myClass = new ClassA();
CMS
2010-05-21 20:39:06