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>
3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Voynex
0

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:

<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>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.