Firefox problem

Asked By mostafa hamdy
17-Aug-06 08:03 AM
Earn up to 0 extra points for answering this tough question.
hi all I have web page which contains table with ans I set for each row in the table Name and Id attributes,and when I try to access soecific row in the table by name it works very fine with IE but it makes problems with firefox and it display in the alert undefined: the code is listed below -------------HTML code----------------------- <table width="50%" bgcolor="#000000"> <tr id="tr1" name="firsttr"><td></td></tr> <tr id="tr2" name="secondtr"><td></td></tr> <tr id="tr3" name="thirdtr"><td></td></tr> </table> ------------------------JS code--------------------------- function myFunction() { var trname = document.getElementByid('tr1').name ; alert(trname); } plz if any body can help me in solving this problem plz send me bets regards Mostafa

  Firefox and IE issues

Asked By J S
17-Aug-06 08:10 AM
This will help u : http://west-wind.com/weblog/posts/1463.aspx

  Example:

Asked By Peter Bromberg
17-Aug-06 09:02 AM
function myFunction() { var trname = document.getElementById('tr1').attributes['name'].value; alert(trname); }

  Table Row Does not have a Name Attribute

Asked By Chad .
17-Aug-06 09:25 AM
Hi, As per W3c Specifications a Table Row does not have a name attribute. Hence it is not advisable. You can use the IDs for the same? Is there any specific constraint that makes you use the name? Let me know in case I can help you. - Chandu
  RE:working code
Asked By Sushila Patel
17-Aug-06 12:23 PM
function myFunction() { var trname = document.getElementById('tr1').getAttribute('name') ; alert(trname); } Tested on Firefox and IE
Create New Account