#1

  1. Join Date
    Jun 2002
    Location
    Kahoka, MO
    Posts
    5
    Rep Power
    0

    can dynamiclly created forms be done in javascript


    This only has to work in ie4.0 or better How would i go about creating a form field that would generate options below such as this without taking me to a new page and just dynamiclly generate the table rows below. I would greatly apprecicate


    Before

    Code:
     <table width="500" border="0" cellspacing="1" cellpadding="3">
        <tr> 
          <td bgcolor="#666699" height="14" colspan="2"><font color="#FFFFFF"><b><font face="Arial, Helvetica, sans-serif" size="2">Options</font></b></font></td>
        </tr>
        <tr> 
          <td bgcolor="#DADAE7" width="118"><font face="Arial, Helvetica, sans-serif" color="#666699" size="2">Option 
            Name</font></td>
          <td bgcolor="#DADAE7" width="367"> 
            <input type="text" name="optionname">
            <select name="num">
              <option value="0">0</option>
              <option value="1">1</option>
              <option value="2">2</option>
              <option value="3">3</option>
              <option value="4">4</option>
              <option value="5">5</option>
              <option value="6">6</option>
            </select>
            <input type="submit" name="Submit" value="Submit1">
          </td>
        </tr>
      </table>

    AFTER

    Code:
    <table width="500" border="0" cellspacing="1" cellpadding="3">
      <tr> 
        <td bgcolor="#666699" height="14" colspan="2"><font color="#FFFFFF"><b><font face="Arial, Helvetica, sans-serif" size="2">Options</font></b></font></td>
      </tr>
      <tr> 
        <td bgcolor="#DADAE7" width="118"><font face="Arial, Helvetica, sans-serif" color="#666699" size="2">Option 
          Name</font></td>
        <td bgcolor="#DADAE7" width="367"> 
          <input type="text" name="optionname2">
          <select name="select">
            <option value="0">0</option>
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
            <option value="6">6</option>
          </select>
          <input type="submit" name="Submit2" value="Submit1">
        </td>
      </tr>
      <tr> 
        <td bgcolor="#CCCCCC" width="118">Color 1</td>
        <td bgcolor="#E0E0E0" width="367"> 
          <input type="text" name="textfield">
          &nbsp;&nbsp;$ 
          <input type="text" name="textfield2" size="12">
        </td>
      </tr>
      <tr> 
        <td bgcolor="#CCCCCC" width="118">Color 1</td>
        <td bgcolor="#E0E0E0" width="367"> 
          <input type="text" name="textfield">
          &nbsp;&nbsp;$ 
          <input type="text" name="textfield2" size="12">
        </td>
      </tr>
    </table>
  2. #2
  3. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Oct 2001
    Location
    New Zealand
    Posts
    1,774
    Rep Power
    24
    Give your <td> tag you want the form fields between and then use:

    document.getElementById('[tagid]').innerHTML = 'input name="whatever">'

    etc...

IMN logo majestic logo threadwatch logo seochat tools logo