Javascript select box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ramya2611
    New Member
    • Jan 2008
    • 1

    Javascript select box

    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.

    [code=html]<html>
    <head><title>xy z</title>
    <script>

    function toggle(me){
    if (me.style.visib ility=="hidden" ){
    me.style.visibi lity="visible";
    }
    else {
    me.style.visibi lity="hidden";
    }
    }


    </script>
    </head>
    <body onload="javascr ipt:document.fs d.search.style. visibility = 'hidden'">
    <br><br><br><br >
    <form name="fsd" method="post" action="xyz.asp " >
    Enter RFC &nbsp;<input type="text" name="rfcname"> &nbsp;<input type="button" title="Click to select a RFC" value="+" onclick="toggle (document.fsd.s earch)">&nbsp;& nbsp;&nbsp;&nbs p;<input type="submit" value="Search">
    <br>
    &nbsp;&nbsp;&nb sp;&nbsp;
    <select name="search" style="width:14 0px;" onchange="javas cript:document. fsd.rfcname.val ue = document.fsd.se arch.options[document.fsd.se arch.selectedIn dex].value;document .fsd.search.sty le.visibility=' hidden'">[/code]

    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
    Last edited by gits; Jan 9 '08, 08:16 AM. Reason: fix code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    To expand and contract, use style.display=" block" and style.display=" none" instead.

    Comment

    Working...