Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


quick help



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
mcnika



Joined: 22 May 2008
Posts: 5

PostPosted: Mon Jun 30, 2008 2:44 pm    Post subject: quick help Reply with quote

Hi

I need a code in Ajax.
Suppose that there is a one text filed, by clicking on the button it must add one textfield too, then one more too and so on, by its own name.
Back to top
View user's profile Send private message
rangana
500+ Club


Joined: 27 Feb 2008
Posts: 626
Location: Cebu City Philippines

PostPosted: Tue Jul 01, 2008 1:44 am    Post subject: Re: quick help Reply with quote

Show us your attempt. Oh, and why AJAX? JS alone can do this for you Wink
Back to top
View user's profile Send private message Yahoo Messenger
svmvishnu



Joined: 30 Jun 2008
Posts: 3

PostPosted: Tue Jul 01, 2008 7:01 am    Post subject: Re: quick help Reply with quote

Hi,

The following is code create a textarea dynamically(when u click the add button). what here i did is just duplicate the textarea and change its id.

<script>

var serial_number = 0;

function addTextArea()
{
container = document.getElementById("container");
div_ele = document.getElementById("test");
text_area = document.getElementById("sample");
div_ele.id = div_ele.id + "-" + serial_number;
text_area.id = text_area.id + "-" + serial_number;
div_ele.style.display = "";
container.appendChild(div_ele.cloneNode(true));
div_ele.id = "test";
text_area.id = "sample";
div_ele.style.display = "none";
serial_number++;
}

</script>

<div id = "container"> </div>
<div id = "test" style="display:none"> <textarea id = "sample"> </textarea> </div>
<input type = "button" value = "add" onClick = "addTextArea()">

Hope this meets your requirement. Laughing

~vishnu~
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap