Hi,
I can't get my semi-dynamic form to work. Maybe you could help.
I've got a simple form with a select box. And a button that, when
clicked, creates another copy if the select box and places it in a
specified div.
<select name="tst[]" id="tst">
<option value=1>1</option>
<option value=2>6</option>
</select>
<input type="button" value="Add"
onclick="create New(document.ge tElementById('t st'),
document.getEle mentById('pasl' ));">
here's the script:
function createNew(sel, div) {
spNew = document.create Element("span") ;
selNew = sel.cloneNode(t rue);
spNew.appendChi ld(selNew);
spNew.innerHTML = spNew.innerHTML + "<input type=\"button\"
value=\"Drop\"
onclick=\"alert (\'ok\');\" id=\"btn\" >";
sp = div.appendChild (spNew);
};
It works ok in IE, but under firefox, the value of the new select is
not submitted. The div that I add the select to is a child of the form,
so this should work, right? What could I have missed?
Another question would be: what is the correct way to specify the event
for a dinamically created button?
Thanks in advance,
Domas