Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Limit Choices in Multiple Select Box
- From: javascript@xxxxxxxxxx (Terry)
- Subject: [Javascript] Limit Choices in Multiple Select Box
- Date: Thu, 12 Dec 2002 09:35:34 -0500
This is a multi-part message in MIME format.
------=_NextPart_000_006F_01C2A1C1.D24A4D00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
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 =20
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 -----=20
From: "David Hannum" <hannum@xxxxxxxx>
To: <javascript@xxxxxxxxxx>
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?
>=20
> Dave
>=20
>=20
>=20
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D
> David R. Hannum
> Web Analyst/Programmer
> Ohio University Computer Services
> Administrative Systems
> (740) 597-2524
>=20
> "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)
>=20
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
>=20
>=20
------=_NextPart_000_006F_01C2A1C1.D24A4D00
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2722.900" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>sure... i have done it =
before... i dont=20
have the code but you will want to look into doing the =
following...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-new array to hold current values =
of selected=20
indexs (HOLDER)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-select.onchange will evoke your =
function to=20
check</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-onchange function:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
check length=20
of HOLDER</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> if > 3 =
then</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
loop select and reset values to =
unselect =20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
loop HOLDER set select.options[HOLDER].selected to=20
true</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> else</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
loop select and insert selected indexes into=20
HOLDER</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Anyway, this is where I would =
start.... I=20
would recommend getting O'Reilly's Javascript - The Definitive=20
Guide</FONT></DIV>
<DIV><BR><FONT face=3DArial size=3D2>~ Terry<BR>757 =
581-5981<BR>AIM/Yahoo:=20
lv2bounce</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>----- Original Message ----- </FONT>
<DIV><FONT face=3DArial size=3D2>From: "David Hannum" <</FONT><A=20
href=3D"mailto:hannum@xxxxxxxx"><FONT face=3DArial=20
size=3D2>hannum@xxxxxxxx</FONT></A><FONT face=3DArial =
size=3D2>></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>To: <</FONT><A=20
href=3D"mailto:javascript@xxxxxxxxxx"><FONT face=3DArial=20
size=3D2>javascript@xxxxxxxxxx</FONT></A><FONT face=3DArial =
size=3D2>></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Sent: Thursday, December 12, 2002 7:52=20
AM</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Subject: [Javascript] Limit Choices in =
Multiple=20
Select Box</FONT></DIV></DIV>
<DIV><FONT face=3DArial><BR><FONT size=3D2></FONT></FONT></DIV><FONT =
face=3DArial=20
size=3D2>> I'm using a script that when a user selects an option in a =
multi-select box,<BR>> it places it in another box. What I need =
to do=20
is limit the number of items<BR>> in the second box to three. =
Can this=20
be done?<BR>> <BR>> Dave<BR>> <BR>> <BR>> <BR>>=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D<BR>> David R. Hannum<BR>> Web=20
Analyst/Programmer<BR>> Ohio University Computer Services<BR>>=20
Administrative Systems<BR>> (740) 597-2524<BR>> <BR>> "If your =
wife is=20
having fun, and you're not . . .<BR>> You're still having a lot more =
fun than=20
if<BR>> you're having fun, and she's not!" (Red Green)<BR>> =
<BR>>=20
_______________________________________________<BR>> Javascript =
mailing=20
list<BR>> </FONT><A href=3D"mailto:Javascript@xxxxxxxxxx"><FONT =
face=3DArial=20
size=3D2>Javascript@xxxxxxxxxx</FONT></A><BR><FONT face=3DArial =
size=3D2>>=20
</FONT><A =
href=3D"https://lists.LaTech.edu/mailman/listinfo/javascript"><FONT=20
face=3DArial=20
size=3D2>https://lists.LaTech.edu/mailman/listinfo/javascript</FONT></A><=
BR><FONT=20
face=3DArial size=3D2>> <BR>> </FONT></BODY></HTML>
------=_NextPart_000_006F_01C2A1C1.D24A4D00--
- References:
- [Javascript] weird JavaScript problem in IE6
- From: Dan
- [Javascript] Limit Choices in Multiple Select Box
- From: David Hannum
- [Javascript] weird JavaScript problem in IE6
- Prev by Date: [Javascript] Limit Choices in Multiple Select Box
- Next by Date: [Javascript] Split
- Previous by thread: [Javascript] Limit Choices in Multiple Select Box
- Next by thread: [Javascript] weird JavaScript problem in IE6
- Index(es):