www.webdeveloper.com
Results 1 to 7 of 7

Thread: help me in select Value

  1. #1
    Join Date
    Oct 2011
    Posts
    2

    help me in select Value

    Please any body help me

    I hava a list box conatain Yes or No
    <select name="select1" onChange="checkAll();" >

    <option value="Yes">Yes</option>
    <option value="No">No</option>
    </select>

    if i change No then my other list box which come from loop
    like

    <select name="a1">

    <option value="Yes">Yes</option>
    <option value="No">No</option>
    </select>

    <select name="a2">

    <option value="Yes">Yes</option>
    <option value="No">No</option>
    </select>
    .
    .
    .
    .

    value change to NO , so i need a java script which perform the same

    please reply me

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,415

    Question

    Quote Originally Posted by lovekhan View Post
    Please any body help me

    I hava a list box conatain Yes or No
    <select name="select1" onChange="checkAll();" >

    <option value="Yes">Yes</option>
    <option value="No">No</option>
    </select>

    if i change No then my other list box which come from loop
    like

    <select name="a1">

    <option value="Yes">Yes</option>
    <option value="No">No</option>
    </select>

    <select name="a2">

    <option value="Yes">Yes</option>
    <option value="No">No</option>
    </select>
    .
    .
    .
    .

    value change to NO , so i need a java script which perform the same

    please reply me
    Huh???

    What does the function "checkAll()" supposed to do?
    What loop are to referring to?
    What value changes to "NO" to perform the same WHAT?

    Your request is unclear to me. Need a bit more information as to what you want to accomplish.

  3. #3
    Join Date
    Oct 2011
    Posts
    2

    help me in select Value

    ok i will clear u

    i have a list box
    <select name="select1" onChange="change();" >

    <option value="Yes">Yes</option>
    <option value="No">No</option>
    </select>

    Here change() is a function call

    <script >

    function change()
    {
    }
    </script>

    some java Script code above

    above change function change all list box value like

    <select name="a1">

    <option value="Yes">Yes</option>
    <option value="No">No</option>
    </select>

    <select name="a2">

    <option value="Yes">Yes</option>
    <option value="No">No</option>
    </select>

    ..

    ..



    this is list box may be 1 or more then 1 because its come from database record


    same type of example is check box in yahoo mail or gmail when we click single check then all check boxes are checked if we removed check from single box then its remove from all boxes

  4. #4
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,415

    Question

    The only change from original post to the last was:
    Code:
    <script >
    
    function change()
    {
    }
    </script>
    which does nothing.

    You request is still unclear to me.

    Also ...
    same type of example is check box in yahoo mail or gmail when we click single check then all check boxes are checked if we removed check from single box then its remove from all boxes
    What checkboxes are to referring to in your postings?


    I could make a code change but since I don't understand what the requirement are
    the change I could make would probably not be to your liking as it would make no sense!

    Do you have some live code to evaluate?
    What you have posted does nothing!
    Last edited by JMRKER; 10-21-2011 at 10:02 AM.

  5. #5
    Join Date
    Oct 2007
    Location
    Western Massachusetts, USA
    Posts
    387
    JMRKER, been a while bud. I think lovekhan wants a select element that will change all other select elements of the same type when it changes, to the same selection. E.g. a "global" select element:
    PHP Code:
    <html>
    <
    head>
    <
    style type="text/css">
    #masterBox,
    #masterBox option { background-color: #000000; color: #ffffff; margin: 0px 0px; padding: 0px 0px; } 
    </style>
    </
    head>
    <
    body>
    <
    label for="masterBox">Change all: </label>
    <
    select id="masterBox" onchange="changeAll(this)">
      <
    option value="0">Yes</option>
      <
    option value="1">No</option>
    </
    select>
    <
    hr>
    <
    script language="javascript" type="text/javascript">

    var 
    numberOfSelects 3;
    var 
    prefix "a";

    function 
    changeAll(master) {
      if (!
    master) { return; }

      for (
    1<= numberOfSelectsi++) {
      var 
    ele document.getElementById(prefix+""+i);
        if (
    ele) {
        
    ele.selectedIndex master.selectedIndex;
        }
      }
    }

      for (
    1<= numberOfSelectsi++) {
      
    document.write("<select id=\""+prefix+""+i+"\">\n");
      
    document.write("  <option value=\"0\">Yes</option>\n");
      
    document.write("  <option value=\"1\">No</option>\n");
      
    document.write("</select>\n");
      }

    </script>
    </body>
    </html> 

  6. #6
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,415

    Talking

    Quote Originally Posted by savvykms View Post
    JMRKER, been a while bud. I think lovekhan wants a select element that will change all other select elements of the same type when it changes, to the same selection. E.g. a "global" select element:
    ...
    Well, if that is what the OP wants,
    you have made it clearer in one post than he/she has done in two!

  7. #7
    Join Date
    Oct 2007
    Location
    Western Massachusetts, USA
    Posts
    387
    Quote Originally Posted by JMRKER View Post
    Well, if that is what the OP wants,
    you have made it clearer in one post than he/she has done in two!
    Thanks JMRKER, I tried. Nobody is great with English grammar or spelling all the time.

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