By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,654 Members | 1,582 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,654 IT Pros & Developers. It's quick & easy.

Display text box automatically after pressing enter key in first text box

kaleeswaran
100+
P: 132
hi!
in my web page...after i am insert the value into text box then i press enter then next text box should display automatically.how to do that....
thank you,
Oct 9 '07 #1
Share this Question
Share on Google+
8 Replies


dmjpro
100+
P: 2,476
hi!
in my web page...after i am insert the value into text box then i press enter then next text box should display automatically.how to do that....
thank you,
Expand|Select|Wrap|Line Numbers
  1. <input type = text onkeypress = "showText(event)">
  2.  
Expand|Select|Wrap|Line Numbers
  1. function showText(e)
  2. {
  3.  var key = e.which ? e.which : e.keyCode;
  4.  if(key == 13)
  5.  {
  6.   //your next processing code goes here
  7.  }
  8. }
  9.  
Debasis Jana
Oct 9 '07 #2

acoder
Expert Mod 15k+
P: 16,027
Changed the thread title to better describe the problem.
Oct 9 '07 #3

kaleeswaran
100+
P: 132
hi!
i need to display the text box dynamically after the customer enter the key...i am having idea we can do using onkeypress event.but i don't know how to that.
so please tell me some idea....
thank you,
Oct 9 '07 #4

acoder
Expert Mod 15k+
P: 16,027
Which part have you got difficulty with? Detecting the enter key or displaying a text box dynamically?
Oct 9 '07 #5

kaleeswaran
100+
P: 132
i feel difficult in both part but now i am getting some idea through you given keycode function now my doubt is how to create the text box dynamically?...
thanks,
Oct 10 '07 #6

dmjpro
100+
P: 2,476
i feel difficult in both part but now i am getting some idea through you given keycode function now my doubt is how to create the text box dynamically?...
thanks,
Having a look at my code.
Expand|Select|Wrap|Line Numbers
  1. var text_ref = document.createElement("input");
  2. text_ref.setAttribute("type","text");
  3. .
  4. .
  5. document.body.appendChild(text_ref);
  6.  
Debasis Jana
Oct 10 '07 #7

kaleeswaran
100+
P: 132
Hi,

i have dynamically created a table with two rows and have inserted text boxes in each column./ Textboxes have also been inserted dynamically. My question is how do i find the id of the textboxes currently being used..
thank you,
Oct 10 '07 #8

dmjpro
100+
P: 2,476
Hi,

i have dynamically created a table with two rows and have inserted text boxes in each column./ Textboxes have also been inserted dynamically. My question is how do i find the id of the textboxes currently being used..
thank you,
Expand|Select|Wrap|Line Numbers
  1. <input type = "text" id = "some_id" onkeypress = "getId(this.id)">
  2.  
Expand|Select|Wrap|Line Numbers
  1. function getId(id)
  2. {
  3.  alert(id);
  4. }
  5.  
Debasis Jana
Oct 10 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.