Click to See Complete Forum and Search --> : expanding form


Justin
10-31-2003, 02:28 PM
is there a way to add a button to a form that when clicked it will add more input boxes like

<form>
<input type="text" name="q1">
<input type="text" name="a1">
<input type="button" value="Add Question" onclick="add()">

when clicked once it would

<form>
<input type="text" name="q1">
<input type="text" name="a1">
<input type="text" name="q2">
<input type="text" name="a2">

clicked twice

<form>
<input type="text" name="q1">
<input type="text" name="a1">
<input type="text" name="q2">
<input type="text" name="a2">
<input type="text" name="q3">
<input type="text" name="a3">

and so on.

When it is clicked submited, it sends a var cells="3"
or cliked 1 var cells="2"
so a loop can uncode the info

it is going to be a quiz page maker.

Khalid Ali
10-31-2003, 05:00 PM
read up on following DOM methods.


createElement();
element.setAttribute("attributeName","attributeValue")
appendChild()

Justin
11-03-2003, 02:20 PM
i cant seem to find that where would i look?