[thelist] What does event.srcElement.innerText refer to?

Tom Dell'Aringa pixelmech at yahoo.com
Tue Oct 28 12:47:58 CST 2003


--- Chris George <cgeorge at basecorp.com> wrote:
> In my quest for JS knowledge, I came across this
> event.srcElement.innerText that I'm not sure what it does.
> 
> Any takers?

Chris,

Without getting too technical:

1 - event is the event triggered on the page by a handler, such as an
onclick, onmouseover, onkeypress etc.

2 - the srcElement is the element where the event originated. It
could be the body, a button or even a div tag.

3 - innerText: 

<http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/ifaces/ihtmlelement/innertext.asp>

Watch the wrap. If I had:

<div id="foo"><p>Hello World!</p></div> innerText would grab "Hello
World!" but not the P tag. (IIRC).

innerText is NOT well supported thus not often used. You see
innerHTML more often, which is quite nice and works in modern NS.

HTH

Tom


=====
http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: JavaScript Author / Every Friday!
http://www.thywordistruth.net/ :: Eternal Life

"I'll ho ho and ha ha you!" (Daffy Duck)


More information about the thelist mailing list