Closed Bug 293971 Opened 20 years ago Closed 20 years ago

javascript event.srcElement.tagName no responding

Categories

(Toolkit Graveyard :: Error Console, defect)

x86
Windows 2000
defect
Not set
major

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: gilberto.melendez, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

<html>
<head>
<script type="text/javascript">
function whichElement(event)
{
var tname
tname=event.srcElement.tagName
alert("You clicked on a " + tname + " element.")
}
</script>
</head>

<body onmousedown="whichElement(event)">
<p>Click somewhere in the document. An alert box will alert the tag name of the
element you clicked on.</p>

<h3>This is a header</h3>
<p>This is a paragraph</p>
<img border="0" src="ball16.gif" width="29" height="28" alt="Ball">
</body>

</html>



Reproducible: Always

Steps to Reproduce:
1.load that page 

2.click on any element
3.and should see a alert but it does nothing

Actual Results:  

Nothing

Expected Results:  
Show alert box with the element clicked

This code was probe on ie6 and it works perfectly
srcElement is not a valid event property, it's IE specific. Mozilla uses
event.currentTarget and event.target, per the W3 DOM spec. See
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-Event-eventPhaseType
and http://www.quirksmode.org/js/events_order.html .
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Product: Firefox → Toolkit
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.