after createElement('input'), get a value

I am using DOM in HTML.
Like the following, I make a new Input form in <span> position.
And if a user enter a value and press a button, I like to show the value.
Making the new input works.
But, getting a value from it does not work.
I cannot find any example to get a value from a input form which is newly made in the same page.
Someone tell me what's wrong with it?

<script language="javascript>
function getValue()
{
   var value = document.form1.newInput.value;
   alert("your value is "+value);   
}

function addForm()
{
...
 var newForm = document.createElement('input');
 newForm.setAttribute('name','newInput');
 newForm.setAttribute('type','text');
 newForm.setAttribute('size','20');

...
}


<body>
....
<form name="form1" ..>
<span id="here"></span>
<type="button" onClick="getValue();" ..>

Received on Wednesday, 6 August 2003 19:40:39 UTC