alisonpurcell
Programmer
Hi,
I'm really stumped with this one so I hope someone can help. I have a DHTML menu that creates some form elements, and this seems to work ok in that they can be read following a submit. However, they need modifying later in the javascript (before the submit) but I can't seem to access them. To test it I have the following code:
menuForm=document.getElementById('form1');
element=document.createElement('input');
element.name='mytest';
menuForm.appendChild(element);
if(menuForm.elements['mytest'])
{
alert("menuForm.elements['mytest'] exists");
}
else
{
alert("menuForm.elements[mytest] doesn't exist");
}
It shows as not existing even though I have just created it.
Any suggestions much appreciated.
I'm really stumped with this one so I hope someone can help. I have a DHTML menu that creates some form elements, and this seems to work ok in that they can be read following a submit. However, they need modifying later in the javascript (before the submit) but I can't seem to access them. To test it I have the following code:
menuForm=document.getElementById('form1');
element=document.createElement('input');
element.name='mytest';
menuForm.appendChild(element);
if(menuForm.elements['mytest'])
{
alert("menuForm.elements['mytest'] exists");
}
else
{
alert("menuForm.elements[mytest] doesn't exist");
}
It shows as not existing even though I have just created it.
Any suggestions much appreciated.