javascript call a privileged method
Posted
by quan
on Stack Overflow
See other posts from Stack Overflow
or by quan
Published on 2010-05-21T20:36:19Z
Indexed on
2010/05/21
20:40 UTC
Read the original article
Hit count: 241
JavaScript
If I call the killSwitch() outside the onkeypress, I'll cause an error. But inside the onkeypress function, I worked just fine. Why?
// this works fine
var ClassA = function()
{
var doc = document;
// killSwitch();
doc.onkeypress = function(e){ killSwitch(); }
this.killSwitch = function(){ alert('hello world'); }
}
var myClass = new ClassA();
© Stack Overflow or respective owner