www.webdeveloper.com
Results 1 to 4 of 4

Thread: drop down menus

  1. #1
    Join Date
    Nov 2008
    Posts
    2

    drop down menus



    pls help us to make drop down menus using array functions and please give us examples for a guidelines....thanks

  2. #2
    Join Date
    May 2007
    Posts
    22
    To create an drop-down box you need something like this:

    Code:
    <select id="ourSelect">
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
    <option value="3">Option 3</option>
    </select>
    You will need to use JavaScript to make it into an array, or to make a drop-down menu from an array. What exactly do you need it to do?

    To read from an array, do something like this:

    Code:
    <script type="text/javascript">
    
    function fillArray() {
    var myCars=new Array("Saab","Volvo","BMW");
    
    document.Write('<select id="ourSelect">');
    document.Write('<option value="1">'+myCars[0]+'</option>');
    document.Write('<option value="2">'+myCars[1]+'</option>');
    document.Write('<option value="2">'+myCars[2]+'</option>');
    document.Write('</select>');
    }
    </script>
    The at the top of your code put:
    Code:
    <body onload="fillArray();">

  3. #3
    Join Date
    Oct 2007
    Location
    Western Massachusetts, USA
    Posts
    387
    Stphen: I think dollpril wants drop down menus.
    dollpril: If you happen to want drop down input boxes, then Stephan has already answered you.

    If you want actual drop down menus, there is a fun trick i found elsewhere on a school website which works well, but I am not sure exactly what they did. Look around, I am sure you can find this same basic question posted all over the Javascript forums.
    Computer programmer / web developer.

  4. #4
    Join Date
    Nov 2008
    Posts
    2
    can u pls help me out in my project coz its inappropriate to use the space or so called &nbsp; in the rm below coz i want to put many spaces between the text and the input form..thank you very much


    <form>
    &nbsp;&nbsp;<b>Station:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
    <input type = "text" name= "visibility"><br><br>
    &nbsp;&nbsp;<b>Time in UTC:</b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;
    <input type = "text" name= "time in utc"> <br><br>
    &nbsp;&nbsp;<b>Wind Condition:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type = "text" name= "wind condition"> <br><br>
    &nbsp;&nbsp;<table width="340" cellspacing="0" cellpadding="2">
    </form>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles