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>

Recommended Answers

All 2 Replies

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>

Yes, name attribute is deprecated in XHTML

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.