[MacEd] How to change the key in an keypress event

macroeditor at mozdev.org macroeditor at mozdev.org
Sat Mar 27 04:21:01 EST 2004


Hello,

    I'm trying to change the key on an keypress event that I've created, 
but it is not working. I tried to call the PrivilegeManager with 
UniversalBrowserWrite first, but it still didn't work. Here is my code 
so far:

var evt = window.content.document.createEvent('KeyEvents');
evt.initEvent('keypress',1,0);
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserWrite');
// evt.which should be 0 in this first alert
alert(evt.which);
evt.which = 86;
// Alert just to see if evt.which changed
alert(evt.which);

    In this code the second alert doesn't appear, because the line 
evt.which = 86; doesn't work. What am I doing wrong?

Thanks,
Geraldo Santos



More information about the MacroEditor mailing list