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

Javascript select box

P: 1
hi
I have the following scenario..
i have a select box containing a list of times. on selecting one of them i am dispalying all the details pertaining to that selection. the list is prone to additions and hence might grow longer. So i would like the user to key in the values directly. So i have a text box and a button next to it on clicking which a dropdown appears. The user can directly enter the value in the text box or select one from the select box.I m setting the value of the text box to the value selected from the drop down in the latter case. In either cases, the value in the text box is taken for processing the request.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head><title>xyz</title>
  3. <script>
  4.  
  5. function toggle(me){
  6.         if (me.style.visibility=="hidden"){
  7.             me.style.visibility="visible";
  8.             }
  9.         else {
  10.             me.style.visibility="hidden";
  11.             }
  12.         }
  13.  
  14.  
  15. </script>
  16. </head>
  17. <body onload="javascript:document.fsd.search.style.visibility = 'hidden'">
  18. <br><br><br><br>
  19. <form name="fsd" method="post" action="xyz.asp" >
  20. Enter RFC &nbsp;<input type="text" name="rfcname">&nbsp;<input type="button" title="Click to select a RFC" value="+" onclick="toggle(document.fsd.search)">&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="Search">
  21. <br>
  22. &nbsp;&nbsp;&nbsp;&nbsp;
  23. <select name="search" style="width:140px;" onchange="javascript:document.fsd.rfcname.value = document.fsd.search.options[document.fsd.search.selectedIndex].value;document.fsd.search.style.visibility='hidden'">
what i would like to have is to make the list expand and contract on clicking the '+' button or someother work around to have the user enter the value or select from the dropdown.

thanks,
ramya
Jan 9 '08 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
To expand and contract, use style.display="block" and style.display="none" instead.
Jan 9 '08 #2

Post your reply

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