Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1188 | Replies: 2
![]() |
•
•
Join Date: Jun 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Here in my project i am using this reference to know my current name of td. Below i provided sample code similar to my project. "this" won't working in Mozilla. I am migrating my project to Mozilla . So please help me.
<html>
<head>
<script>
function f(a)
{
alert(a);
}
</script>
</head>
<body>
<table border="1">
<tr>
<td name="dfdsfs11111111" onclick="f(this.name)">sadasd</td>
<td name="dsfdsfsd222222" onclick="f(this.name)">asdasd</td>
</tr>
</table>
</body>
</html> According to the standards, <td> doesn't have a 'name' attribute and neither does <tr> or <table> as a matter of fact. IE supports it, Opera doesn't, Firefox doesn't. IE is infamous of supporting non standard things.
The only thing you can do is to replace each occurrence of 'name' with 'id' attribute since each element supports the 'id' attribute.
See this example to know more:
The only thing you can do is to replace each occurrence of 'name' with 'id' attribute since each element supports the 'id' attribute.
See this example to know more:
html Syntax (Toggle Plain Text)
<html> <head> <script type="text/javascript"> function doName(name) { alert("ID: " + name.id); alert("Name: " + name.name); } </script> </head> <body> <table id="TABLE" name="TABLE" onclick="doName(this);" border="1"> <tr id="TR" name="TR" onclick="doName(this);"> <td id="TD" name="TD" onclick="doName(this);">CLICK ON ME</td> </tr> </table> </body> </html>
Last edited by ~s.o.s~ : Jul 1st, 2007 at 2:39 am.
I don't accept change. I don't deserve to live.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode