SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    On change: text field box appears

    hi,
    i would like to make a drop down menu box appear, when a user selects a certain option from the first drop down menu box.

    how do i achieve this ?

    thanks
    afrika

  2. #2
    SitePoint Evangelist SpaceFrog's Avatar
    Join Date
    Jan 2005
    Location
    Outerspace
    Posts
    511
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    change the style.visibility of object or style.display ...

  3. #3
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry, i am not a javascript programmer, I can only code in ASP VB script and MS SQL server

    could you please show me how this is done ? with javascript ?

    thanks a lot

  4. #4
    SitePoint Evangelist SpaceFrog's Avatar
    Join Date
    Jan 2005
    Location
    Outerspace
    Posts
    511
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <script type='text/javascript'>
    function showselect2(Obj){
    document.getElementById('sel').style.display=(Obj.selectedIndex==1)?'':'none';
    }
    </script>
    
    
    </head>
    
    <body>
    <select onclick="showselect2(this)">
    <option value=0> select an option</option>
    <option value=1>1</option> 
    <option value=2>2</option> 
    <option value=3>3</option> 
    </select>
    <br/>
    
    <select id="sel" style='display:none'>
    <option>12</option> 
    <option>22</option> 
    <option>32</option> 
    </select>
    
    
    </body>
    
    </html>
    It does not seem to work with visibility... ???

  5. #5
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank u Spacefrog

    :-)
    Afrika

  6. #6
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank u Spacefrog

    just what i needed

    :-)
    Afrika

  7. #7
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hello Again Spacefrog,
    i added two textfield boxes.

    1. I want the local to show when option 1 is selected (In addition to the first option selected)

    2. and the international to show when any other option is selected

    how do i achieve this ?
    thanks once again

    <script type='text/javascript'>
    function showselect2(Obj){
    document.getElementById('sel').style.display=(Obj.selectedIndex==1)?'':'none';
    }
    </script>


    </head>

    <body>
    <select onchange="showselect2(this)">
    <option value=0> select an option</option>
    <option value=1>1</option>
    <option value=2>2</option>
    <option value=3>3</option>
    </select>
    <br/>

    <select id="sel" style='display:none'>
    <option>12</option>
    <option>22</option>
    <option>32</option>
    </select> <input type="text" name="local" size="20"style='display:none'><input type="text" name="international" size="20"style='display:none'>


    </body>

    </html>


Bookmarks

Posting Permissions

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