Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using srcElement.type ??

Status
Not open for further replies.

econnections

IS-IT--Management
Apr 28, 2006
30
GB
I would like to use the piece of code below not to capture image events but when I click on TD's with a class set. eg class='style1'

if (window.event.srcElement.type == "image"){}

How do I change the above to capture:

1) TD's

2) class='style1'

3) TD#style1

I would appreciate any help. I'm using IE6

Cheers
 
[1] TD
[tt]if {window.event.srcElement.tagName=="TD") {[/tt]

[2] class='style1'
[tt]if {window.event.srcElement.className=="style1") {[/tt]

[3] TD#style1
[tt]if {window.event.srcElement.tagName=="TD" && window.event.srcElement.id=="style1") {[/tt]

 
Futher note:

[2 bis] class='style1' (more general setting)
[tt]if {window.event.srcElement.className.indexOf("style1")!=-1) {
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top