thereal88
09-12-2006, 04:57 PM
I have something like this:
<table>
<form name=searchform>
<tr><td><input type=text name=notimportant></td></tr>
<tbody>
<tr><td><input type=text name=thefield></td></tr>
</tbody>
</table>
</form>
I need to get the value of thefield using JavaScript. I tried this:
alert(document.searchform.thefield.value)
but it doesn't work. However,
alert(document.searchform.notimportant.value)
will give me the value of the field named 'notimportant', which is not inside the <tbody> element. I'm guessing it has to do with the <tbody>. I can't get rid of it because I need it to add rows to the table, also using JavaScript.
Does anyone know how to get the value of 'thefield'?
Or otherwise, how to add rows in the middle of a table (between other rows), without a <tbody>?
<table>
<form name=searchform>
<tr><td><input type=text name=notimportant></td></tr>
<tbody>
<tr><td><input type=text name=thefield></td></tr>
</tbody>
</table>
</form>
I need to get the value of thefield using JavaScript. I tried this:
alert(document.searchform.thefield.value)
but it doesn't work. However,
alert(document.searchform.notimportant.value)
will give me the value of the field named 'notimportant', which is not inside the <tbody> element. I'm guessing it has to do with the <tbody>. I can't get rid of it because I need it to add rows to the table, also using JavaScript.
Does anyone know how to get the value of 'thefield'?
Or otherwise, how to add rows in the middle of a table (between other rows), without a <tbody>?