Results 1 to 3 of 3

Thread: Checkbox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331

    Checkbox

    . , , -. , :

    Code:
    <input name="vip_ID  " type="checkbox" id="destination_ID  " onClick="checkVip(this);"/>
    , , - destination_ID , .

    :

    Code:
    <script language="javascript">
    
    var checked =      
    				
    var maxChecked = 5;
    	
    function checkVip(object)
    {				
    if(object.checked) {					
    checked = checked + 1;					
    } else {
    checked = checked - 1;					
    }				
    if(checked > maxChecked) {					
    object.checked = false;					
    checked = checked - 1;					
    alert(" ...");					
    }				
    }
    				
    </script>
    , , .

    , .

  2. #2
    rogozen's Avatar
    Join Date: Nov:2005
    Location:
    Posts: 357
    Quote Originally Posted by z0ne View Post
    ...
    ,
    , , destination_ID . , . :
    Code:
    var map = {};
    map['dest_id_1'] = {current: <%    %>, max: <%    %>};
    map['dest_id_2'] = {current: <%    %>, max: <%    %>};
    ...
    
    function checkVip(object)
    {
        var dest_id = object.id;
        var currentChecked = map[dest_id].current;
        var maxChecked = map[dest_id].max;
        if(object.checked) {					
            currentChecked++;
        } else {
            currentChecked--;				
        }				
        if(currentChecked > maxChecked) {					
            object.checked = false;					
            currentChecked--;
            alert(" ...");					
        }
        map[dest_id].current = currentChecked;
    }
    .

  3. #3
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    . .

Posting Permissions

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

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |