value of select box

Discussion in 'C#' started by red_fiesta, Nov 24, 2006.

  1. #1
    i have a select box

    on one of the options it has an on click option to check all check boxes on page

    problem is that when this code runs it takes the value of the check box and replaces it with a javascript value..

    i dont want this

    see code

    JavaScript Code top of page

    <script language="javascript" type="text/javascript">
    
    <!-- Begin
    var checkflag = "false";
    function check(field) {
    if (checkflag == "false") {
      for (i = 0; i < field.length; i++) {
      field[i].checked = true;}
      checkflag = "true";
      return "Uncheck all"; }
    else {
      for (i = 0; i < field.length; i++) {
      field[i].checked = false; }
      checkflag = "false";
      return "Check all"; }
    }
    //  End -->
    </script>
    Code (markup):

    <form name="userRights" method="post" action="nextPage.asp">	
    <select name="adminLevel">
    	<option value="0">Please Select</option>
    	<option  onClick="this.value=check(document.userRights)" value="4">Admin of site </option>
    	<option value="3">General User of site </option>
    </select>
    Code (markup):
    on the next page if i do a response.write of adminLevel when i have selected the 'Admin of Site' option it writes the value Check all or Uncheck all and not 4 what i want it to.

    Please advise...

    Thanks
     
    red_fiesta, Nov 24, 2006 IP
  2. pushkar

    pushkar Peon

    Messages:
    125
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    cant understand proper.What u want please explain again.

    Do u have problem in check Or Uncheck All??
     
    pushkar, Dec 5, 2006 IP