Can you give me an Idea on this ?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Can you give me an Idea on this ?

  1. #1
    Join Date
    Jun 2008
    Posts
    142

    Can you give me an Idea on this ?

    Hi ,

    In my page i need to use two different dropdowns, one is for to display Users and other one is for to display Groups. But at a time only one dropdown will display. For this functionality i am using one more dropdown with values Users and Groups. When i select Users from dropdown only Users related dropdown will display and when i select Groups from dropdown only Groups related dropdown needs to display. Can you give an Idea on this one. ??

    Thanks in advance....

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,858

    Re: Can you give me an Idea on this ?

    Do you ever do any research before posting? Have you gone through any JavaScript tutorials?

    This is a very basic concept. Use the onchange attribute of the dropdown to change the CSS of the other two dropdowns.

    Code:
    <script type="text/javascript">
    function changeDropDown(which) {
      if (which == "groups") {
        document.getElementById('groups').style.display = "";
        document.getElementById('users').style.display = "none";
      }
      else {
        document.getElementById('groups').style.display = "none";
        document.getElementById('users').style.display = "";
      }
    }
    </script>
    
    <select onchange="changeDropDown(this.value)">
      <option value="groups">Groups</option>
      <option value="users">Users</option>
    </select>
    
    <select id="groups" style="display: none;">
    </select>
    
    <select id="users" style="display: none;">
    </select>
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center