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 4 of 4

Thread: Please help!!

  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Please help!!

    I have a problem! I have four radio buttons named searchtype. Each button has its own value lets say one, two, three, four. when buttons two through four are selected i want a text box with the text enter city in it. Below that I want a dropdown list with the values a, b, c, d for radio two. e,f,g,h for radio three, and i,j,k,l for radio four. when radio one is selected i want a drop down list with a1,b1,c1,d1, and below that another drop down the same as if radio two was selected.

    So now that I have totally lost you, is there anyone who can help me? Thanks in advance. bprego

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Why don't you try coding something....
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry

    If i knew how to do this why would I ask for help?? Could you at least get me started?

  • #4
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,529
    Thanks
    3
    Thanked 511 Times in 498 Posts
    PHP Code:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd"
    >

    <
    html>

    <
    head>
      <
    title></title>
    <
    script language="JavaScript" type="text/javascript">
    <!--
    // values a, b, c, d for radio two.
    var  twoAry=new Array( 'a''b''c''d');

    // values e, f, g, h for radio three.
    var  threeAry=new Array( 'e''f''g''h');

    // values i, j, k, l for radio four.
    var  fourAry=new Array( 'i''j''k''l');

    function 
    SearchType(val){
     
    document.getElementById('entercity').style.visibility='visible';
     if (
    val=='one'){ document.getElementById('entercity').style.visibility='hidden'; }
     else {
      
    Ary=eval(val+'Ary');
      for (
    i=0;i<Ary.length;i++){
       
    document.getElementById('Sel1').options[i]=new Option(Ary[i],Ary[i],true,true);
      }
      
    document.getElementById('Sel1').selectedIndex=0;
      if (
    val=='two'){
       for (
    i1=0;i1<Ary.length;i1++){
        
    document.getElementById('Sel2').options[i1]=new Option(Ary[i1],Ary[i1],true,true);
       }
       
    document.getElementById('Sel2').selectedIndex=0;
      }

     }
    }

    //-->
    </script></head>

    <body>
    I have a problem!
    I have four radio buttons named searchtype. <br>

     Each button has its own value lets say one, two, three, four.<br>
    <input type="radio" name="searchtype" value="one" onclick="javascript:SearchType(this.value);" ><br>
    <input type="radio" name="searchtype" value="two" onclick="javascript:SearchType(this.value);" ><br>
    <input type="radio" name="searchtype" value="three" onclick="javascript:SearchType(this.value);" ><br>
    <input type="radio" name="searchtype" value="four" onclick="javascript:SearchType(this.value);" ><br>
    when buttons two through four are selected i want a text box with the text enter city in it.<br>
    <input id="entercity" size="10" value="enter city" style="visibility:hidden;" ><br>

     Below that I want a dropdown list with the values a, b, c, d for radio two.<br>
      e,f,g,h for radio three,                                                      <br>
       and i,j,k,l for radio four.<br>
        when radio one is selected i want a drop down list with a1,b1,c1,d1,<br>
    <select name="Sel1" size="1" style="width:50px;" >

    </select>
    <br>
         and below that another drop down the same as if radio two was selected.<br>
    <select name="Sel2" size="1" style="width:50px;" >
    </select><br>
    I have made the text = val so you can see something happening<br>
    </body>

    </html> 


  •  

    Posting Permissions

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