add controls dynamically in html page

O

ojvm

thanks in advance for reading this.

i am a really ignorant about js, so i need a guru to help me.

i need to add n number of text box in a html page, the main idea is
when the user press a button apear 2 text box and if he do it again
apear 2 text box more and so on, also need that all the text boxes has
a unique id, in order to make some thing whit the values. but i dont
know how to do it. please hel me i'm trapped in this.
 
J

Jc

ojvm said:
thanks in advance for reading this.

i am a really ignorant about js, so i need a guru to help me.

i need to add n number of text box in a html page, the main idea is
when the user press a button apear 2 text box and if he do it again
apear 2 text box more and so on, also need that all the text boxes has
a unique id, in order to make some thing whit the values. but i dont
know how to do it. please hel me i'm trapped in this.

You will need to learn how to manipulate the browser DOM through
javascript in order to do this. This is referred to as DHTML,
http://www.w3schools.com/ is listed as a reference for DHTML on this
groups FAQ, which is located at http://www.jibbering.com/faq/.

You will likely choose to use one of two techniques:

1. The document.createElement() method combined with
appendChild()/insertBefore().

2. The innerHTML property.

References on these methods/properties can be found here:
http://msdn.microsoft.com/library/d...hor/dhtml/reference/dhtml_reference_entry.asp

You will also need to use javascript control statements such as a loop
in order to easily add multiple textboxes:
http://msdn.microsoft.com/library/d...56/html/js56jslrfJScriptLanguageReference.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top