villermen Posted May 1, 2010 Share Posted May 1, 2010 Couldn't find anything about this on the internet, so I'll just ask it here.My JavaScript code will not work because I can't use getElementsByName twice.I tried to fix this by using names, but I can't think of a solution now. <table> <tr class="dung_row" name="row8"> <td class="dung_column" name="column1"> </td> <td class="dung_column" name="column2"> </td> <td class="dung_column" name="column3"> </td> <td class="dung_column" name="column4"> </td> <td class="dung_column" name="column5"> </td> <td class="dung_column" name="column6"> </td> <td class="dung_column" name="column7"> </td> <td class="dung_column" name="column8"> </td> </tr> </table> <script type="text/javascript"> document.getElementsByName("row8")[0].column1.innerHTML="BASE"; </script> Please help me fix the line starting with "document.getElem..."shouldn't document.row8.column1.innerHTML work?Gr.Villermen Link to comment Share on other sites More sharing options...
justsomeguy Posted May 1, 2010 Share Posted May 1, 2010 My JavaScript code will not work because I can't use getElementsByName twice.Why can't you use it twice? Has your local government passed a law saying that you're only allowed to use it once?Look into the DOM methods, there are several ways to access a node's children other than by referring to them by name. You can access the first child, the next, etc.http://www.howtocreate.co.uk/tutorials/javascript/dombasics Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.