It is not recommended that you try to manage the default browser events-events by falsifying events. To the extent that this can be done at all, it is browser-specific and unreliable.
If you want to add the letter 't to the field, say this:
q.value+= 't';
In more complex cases, for example, if you want to insert a letter at the current cursor position, you need a branch code for document.selection (IE) and field.selectionStart/End (others).
source share