0

I have below form containing table

<form name="editor">
<table>
<tr>
<td>
<select>
  <option value="37">A</option>
  <option value="38">B</option>
  <option value="39">C</option>
  <option value="40">D</option>
</select>
</td>
<td>
<select>
  <option value="37">A</option>
  <option value="38">B</option>
  <option value="39">C</option>
  <option value="40">D</option>
</select>
</td>
</tr>
<td>
<select>
---
---
</select>
</td>
</tr>
</table>
<INPUT Type=Button Value="Play" onClick='playt()'>
</form>`

I will have dynamic rows in the table. I want to pass whole table to JavaScript function & want to access values of cells in JavaScript function in array variable.

function playt()

{

  var i = document.getElementsByTagName('td').length;
  var composition = document.getElementsByTagName('td');
  document.getElementById("demo").innerHTML = "Found " + composition[0] + " elements in the form.";
}
</script>
  • 2
    where's you javascript code???? – Bhojendra Rauniyar Feb 06 '15 at 17:57
  • Read this question: http://stackoverflow.com/questions/9579721/convert-html-table-to-array-in-javascript It's answering you question.. – morha13 Feb 06 '15 at 17:58
  • *I will... I want to... & want to...* Have you tried anything? – LcSalazar Feb 06 '15 at 17:59
  • are you open to jQuery? – indubitablee Feb 06 '15 at 18:01
  • :-) I tried alot, but I am not a developer, I have idea of music app & I am trying to create it, so learning HTML & Javascript – user3467180 Feb 06 '15 at 18:01
  • You're wanting so much... How about learning [HTMLTableElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement) and [for statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for)? – Teemu Feb 06 '15 at 18:04
  • i dont think he's wanting so much, i want to become the avatar. perhaps you and i both need to look for some tutorials and work through them to understand how html and javascript works. – indubitablee Feb 06 '15 at 18:15

0 Answers0