Click to See Complete Forum and Search --> : type of event.target


gauravg77
10-21-2003, 11:37 AM
Hello,

I need help here.

This is regarding onkeypress function.

I have the followng in my javascript code.

document.captureEvents(EVENT.KEYPRESS)

So my onkeypress function is invoked for all key-strokes while the focus is anywhere in the document.

However I need to differentiate, based on where the focus is. Specially, I need to know if the focus is on an href link.

How can I go about it.

I understand there is a 'target' property of the event. But does the target hsa something like target.type which I can check if its = "href" (for ex)

TIA,
Gaurav

Khalid Ali
10-21-2003, 07:19 PM
You are on right track

here is the piece of code to get the node Name
var nodename = e.target.nodeName;
alert(nodename)