Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
is there a way to code this
http://i51.tinypic.com/efqsgi.gif[^]

if you didn't get what is happening in the picture:
when you click on a text box it expands and also has a select menu to the right

here is an example i found:
http://jsbin.com/uduzo[^]
Posted
Updated 21-Dec-10 23:31pm
v2
Comments
Dylan Morley 22-Dec-10 5:18am    
Yes, there is a way to code that.

Is that your question, or is it 'give me all the code required to do that'?
Ankur\m/ 23-Dec-10 0:01am    
I am sure that was your down-vote that didn't make much difference to the score.
Someone tries to help you and you return him a low-vote. If you give me one valid reason why you voted it down, I will accept it happily. Or else I request you to reconsider it.

1 solution

Yes there is and let me tell you how. But you have to try and code it yourself.

i) On your web page add a text box. Now add a drop down list populated with required values and make it invisible.
Note: It is important to use the style display: none; for making it invisible rather than setting the visibility of the control to false.
ii) Then attach a JavaScript function on onclick of the text box.
This function will do following things:
a) Set the visibility of the text box to false. (Again, using the style display: none)
b) Set the visibility of the drop down to true.

You also need to take care of the styles of both the controls so that they lie exactly at the same place as shown in the picture.

It is not very hard. Give it a try. Get back in case you have issues.
 
Share this answer
 
Comments
Dalek Dave 22-Dec-10 6:40am    
Fair enough answer.
Ankur\m/ 22-Dec-10 6:47am    
Thanks, DD. This really deserves some good points. :)
zitlem 27-Dec-10 0:34am    
how would the javascript look like (if-else?)
Ankur\m/ 27-Dec-10 0:43am    
Something like:
function showDropDown()
{
document.getElementById("TextBox1").style.display = "none";
document.getElementById("DropDownList1").style.display = "block";
}

Have you voted me a 2? Does this answer not help you? Let me tell you that 1 is the lowest vote and 5 - the highest. Please vote answers judiciously.
Ankur\m/ 27-Dec-10 0:49am    
You mail have to play with different values of 'display' for it to display properly on every browser.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900