www.webdeveloper.com
Results 1 to 4 of 4

Thread: Referring to a table element

  1. #1
    Join Date
    Aug 2003
    Posts
    54

    Referring to a table element

    Hello,

    In javascript, how do I refer to the 'in_newtask' element in the form below? Please note that this element is inside a table.

    Thanks

    <FORM ACTION="emp" METHOD="POST" name=add_tasks_form>
    <table id="tasktable1" align="left" cellspacing="0" cellpadding="2" border="0">
    <TR>
    <td><left>Enter New Task:</left></td>
    <TD><INPUT TYPE="text" NAME="in_newtask" SIZE="50" MAXLENGTH="50"></TD>
    </TR>
    <BR>
    <BR>
    </table>
    <BR>
    <BR>
    <table id="tasktable2" align="center" cellspacing="0" cellpadding="2" border="0">
    <tr><td><right>Current Tasks:</right></td></tr>
    <TR>
    <td>
    <SELECT name=in_tasklist multiple readonly size=10>
    <OPTION VALUE="33">AAA
    <OPTION VALUE="31">BBB
    </SELECT>
    </td>
    </TR>
    </table>
    <BR>
    <BR>
    <div align="center">
    <td><INPUT TYPE="button" VALUE="Add" onClick=ConfirmAction()></td>
    <INPUT TYPE="submit" NAME="Action" VALUE="Delete">
    </div>
    </FORM>

  2. #2
    document.add_tasks_form.in_newtask.value="yes"

    would place the value "yes" in the text box.

  3. #3
    Join Date
    Aug 2003
    Posts
    54
    Would that work for reading the value from that field ?

    I don't need to use the table name that this field is in?

    Thanks

  4. #4
    You don't need to reference the table element to get the value from the form element. To do that you could do this":

    myvalue=document.add_tasks_form.in_newtask.value

    The variable "myvalue" would now contain the value from the form element.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles