Hi javascript gurus,
I have a table with a structured as below. What I want to do is place the id abc into an array like so myarray=[a,b,c];
I know that document.getElementById goes to the table called waterloo and getElementsByTagName('td') gets all the tds
then I am looping over them all. All the alert gives me are three commas like so ,,,
Any help would be great
Code:<table id="waterloo"> <tr> <td id="a"></td> <td id="b"></td> <td id="c"></td> </tr> </table> <script> var myTdId =[]; var x= document.getElementById(formId).getElementsByTagName('td'); for (var i=0; i<x.length; i++) { if (x[i].hasOwnProperty) { myTdId.push(temp[i]); } } alert (myTdId); </script>



Reply With Quote

Bookmarks