-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 06 August 2003 11:14 pm, yj wrote: wi> 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); > } try document.form1.newInput.nodeValue(); > > function addForm() > { > ... > var newForm = document.createElement('input'); > newForm.setAttribute('name','newInput'); > newForm.setAttribute('type','text'); > newForm.setAttribute('size','20'); > > ... > } Okay, you created the element "input" that may be accessed using the variable newForm, but you didn't add it to the document yet. try: document.form1.appendChild(newForm); > <body> > .... > <form name="form1" ..> > <span id="here"></span> > <type="button" onClick="getValue();" ..> I hope this helps, Christian Parpart. - -- 02:31:58 up 78 days, 17:35, 2 users, load average: 0.01, 0.03, 0.12 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/MaBaPpa2GmDVhK0RAvsAAJ4pv2jX/0JaVh8YcepBdhcNAAnAoQCggq3/ Z5Fcv1ZUYQmM0Q/uqC9O418= =jGIX -----END PGP SIGNATURE-----Received on Wednesday, 6 August 2003 20:36:57 GMT
This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:57 GMT