IE / FF onclick behaviour and "this"

P

PlutoPlanet

Hello World,

the code below shows 2 elements with "onClicks".

In IE all 3 values are alerted when clicking one of the elements
In FF only "this.id" is alerted on the table element and "this.id" and
"this.name" on the button element.

Is it possible to pass anything other than "this.id" (or a const
string) to a function which fired by onclick in FF?

In IE I can pass the whole object as argument: <td name="coolname"
onclick=myfunc( this );> and get the values in the function: function
myfunc( Owner ) { alert( Owner.name ); } --- that can make a lot of
things very easy...

Is there a way to get something like that work on FF?

<html>
<body>

<button name="buttonName" id="buttonId"
individualattribute="individualValue" onclick="alert( this.name + '\n'
+ this.id + '\n' + this.individualattribute );">click me</button>

<table border=1 name="tableName">
<tr name="trName">
<td name="tdName" id="tdId" individualattribute="individualValue"
onclick="alert( this.name + '\n' + this.id + '\n' +
this.individualattribute );">
also 4 testing
</td>
</tr>
</table>

</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top