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

how to display more than 1 item in textbox using dropdown

P: 17
Hai,

Here is my code which display one items at a time in textbox, i need to display more than 1 item in a textbox.
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script language="javascript" type="text/javascript"> 
  4. function addit(){ 
  5.     if(document.getElementById("add").value=="1") 
  6.     { 
  7.         document.getElementById("chatmsg").value="Hai" 
  8.     document.getElementById("chatmsg").focus();
  9.     } 
  10.     if(document.getElementById("add").value=="2") 
  11.     { 
  12.         document.getElementById("chatmsg").value="Hello" 
  13.     document.getElementById("chatmsg").focus();
  14.     } 
  15. }
  16. </script>
  17. </head>
  18.  
  19. Enter Value:<input type="text" name="chatmsg">
  20.  <select name="add" id="add" onChange="addit()">
  21.  <option>--Select--</option>
  22.  <option value="1">Hai</option>
  23.  <option value="2">Hello</option>
  24.  </select>
  25.  
Regards
Zabi
Mar 22 '11 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Use += to append rather than overwrite the previous value.
Mar 23 '11 #2

Post your reply

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