- From: yj <yuh108@psu.edu>
- Date: 06 Aug 2003 17:14:28 -0400
- To: <www-dom@w3.org>
- Message-ID: <002301c358b6$3896e090$2c5c4742@hewlett9por0s0>
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