[Javascript] Limit Choices in Multiple Select Box

Terry bader at tcbader.com
Thu Dec 12 08:35:34 CST 2002


sure...  i have done it before...  i dont have the code but you will want to look into doing the following...

-new array to hold current values of selected indexs (HOLDER)

-select.onchange will evoke your function to check

-onchange function:
     check length of  HOLDER
    if > 3 then
            loop select and reset values to unselect    
            loop HOLDER set select.options[HOLDER].selected to true
    else
            loop select and insert selected indexes into HOLDER



Anyway, this is where I would start....  I would recommend getting O'Reilly's Javascript - The Definitive Guide

~ Terry
757 581-5981
AIM/Yahoo: lv2bounce


----- Original Message ----- 
From: "David Hannum" <hannum at ohio.edu>
To: <javascript at LaTech.edu>
Sent: Thursday, December 12, 2002 7:52 AM
Subject: [Javascript] Limit Choices in Multiple Select Box


> I'm using a script that when a user selects an option in a multi-select box,
> it places it in another box.  What I need to do is limit the number of items
> in the second box to three.  Can this be done?
> 
> Dave
> 
> 
> 
> ===============================
> David R. Hannum
> Web Analyst/Programmer
> Ohio University Computer Services
> Administrative Systems
> (740) 597-2524
> 
> "If your wife is having fun, and you're not . . .
> You're still having a lot more fun than if
> you're having fun, and she's not!"  (Red Green)
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20021212/fa7f8746/attachment.htm>


More information about the Javascript mailing list