Hi All!
In the code below, I want to add a handler to a *row* (eventually so I can
change the style of a row), but the event is being generated by the TD's it
seems - in Opera and IE. Is there another way to assign a handler, making
sure the event will come from the row and not a TD, or is this simply a box
model issue I cannot work around by assigning new handlers?
Any advice appreciated!
Rob
:)
<html>
<head>
<title>Hover on Row Test</title>
<script type="text/javascript">
function addEventHandler (element, eventName, functionName) {
if (element.attach Event) {
element.attachE vent(eventName, functionName);
}
}
function info(event) {
infoElement = event.srcElemen t;
alert (infoElement.no deName + " contains " + infoElement.inn erHTML);
}
</script>
</head>
<body>
<table>
<tr><td>cell 1</td><td>cell 2</td></tr>
<tr><td>cell 1</td><td>cell 2</td></tr>
<tr><td>cell 1</td><td>cell 2</td></tr>
</table>
<script type="text/javascript">
elements = document.body.g etElementsByTag Name("tr");
for(var index = 0; index < elements.length ; index++) {
addEventHandler (elements[index], "onmouseove r", info);
}
</script>
</body>
</html>
In the code below, I want to add a handler to a *row* (eventually so I can
change the style of a row), but the event is being generated by the TD's it
seems - in Opera and IE. Is there another way to assign a handler, making
sure the event will come from the row and not a TD, or is this simply a box
model issue I cannot work around by assigning new handlers?
Any advice appreciated!
Rob
:)
<html>
<head>
<title>Hover on Row Test</title>
<script type="text/javascript">
function addEventHandler (element, eventName, functionName) {
if (element.attach Event) {
element.attachE vent(eventName, functionName);
}
}
function info(event) {
infoElement = event.srcElemen t;
alert (infoElement.no deName + " contains " + infoElement.inn erHTML);
}
</script>
</head>
<body>
<table>
<tr><td>cell 1</td><td>cell 2</td></tr>
<tr><td>cell 1</td><td>cell 2</td></tr>
<tr><td>cell 1</td><td>cell 2</td></tr>
</table>
<script type="text/javascript">
elements = document.body.g etElementsByTag Name("tr");
for(var index = 0; index < elements.length ; index++) {
addEventHandler (elements[index], "onmouseove r", info);
}
</script>
</body>
</html>
Comment