Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Looking at how to limit a pull down

    Hello Everyone,

    I have a pull down that is months of the year, I would like to write something that will limit it to only show June. If they click on the pull down no other options appear. Is this doable in JS? Any suggestions? Thanks!

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,534
    Thanks
    3
    Thanked 512 Times in 499 Posts
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    <!--
    function Populate(){
     var monthary=new Array('Month','January','February','March','April','May','June','July','August','Setember','October','November','December');
     var args=Populate.arguments;
     var sel=document.getElementById(args[0]);
     sel.options.length=0;
     for (var zxc0=1;zxc0<args.length;zxc0++){
       sel.options[sel.options.length]=new Option(monthary[args[zxc0]],args[zxc0],true,true);
     }
     sel.selectedIndex=0;
    
    }
    //-->
    </script></head>
    
    <body>
    
    <input type="button" name="" value="Month 1 and 6" onclick="Populate('txt',0,1,6);" >
    <input type="button" name="" value="Month 3 and 9" onclick="Populate('txt',0,3,9);" >
    <select id="txt" ></select>
    </body>
    
    </html>
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #3
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you!


  •  

    Posting Permissions

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