ERLEDIGT
NEIN
NEIN
ANTWORTEN
4
4
ZUGRIFFE
428
428
EMPFEHLEN
-
Wie kann man per Javascript Optionen von Select 1 in Select 2 Tauschen?
-
Schritt 1:
Per new Option()Ein neues option-Object erzeugen und mit text/value der zu verschiebenden Option belegen.
Schritt2.
Zu verschiebende Option aus der Liste 1 löschen, indem du ihr den Wert [null zuweist.
Schritt 3.
das in Schritt 1 erzeugte Object ans Ende der Liste2 ranhängen.
http://www.tutorials.de/images/menupics/pfeilorange.gif Mehr zu dem Thema:
-
Okay danke,)
-
02.07.04 13:31 #4
- Registriert seit
- Nov 2002
- Ort
- Altdorf bei Nürnberg
- Beiträge
- 3.027
Du kannst dir das neue Option-Objekt auch sparen, indem du gleich das alte
an die andere Liste anhängst.
Bsp:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
<script type="text/javascript"> function swapOptions(a_sForm, a_sSel1, a_sSel2) { oForm = window.document.forms[a_sForm]; oSel1 = oForm.elements[a_sSel1]; oSel2 = oForm.elements[a_sSel2]; oSel2.options[oSel2.options.length] = oSel1.options[oSel1.selectedIndex]; oSel1.options[oSel1.selectedIndex] = null; } </script> <form name="FooForm"> <div style="width:160px; float:left; text-align:center;"> <select name="Sel1" size="6" style="width:150px;"> <option value="val1">Eintrag 1</option> <option value="val2">Eintrag 2</option> <option value="val3">Eintrag 3</option> <option value="val4">Eintrag 4</option> </select> <br /> <br /> <input type="button" value=">>" onclick="swapOptions('FooForm', 'Sel1', 'Sel2');" /> </div> <div style="width:160px; float:left; text-align:center;"> <select name="Sel2" size="6" style="width:150px;"> <option value="1lav">1 gartniE</option> <option value="2lav">2 gartniE</option> <option value="3lav">3 gartniE</option> <option value="4lav">4 gartniE</option> </select> <br /> <br /> <input type="button" value="<<" onclick="swapOptions('FooForm', 'Sel2', 'Sel1');" /> </div> </form>
-
Hmm, komisch bei mir kommt die Fehlrmeldung das Objekt unterstütz die Eigenschaft oder Methode nicht.
Geändert von Nuka (03.07.04 um 18:33 Uhr)
Ähnliche Themen
-
Gibt es bei SUM optionen?
Von Scorpentz im Forum Relationale DatenbanksystemeAntworten: 2Letzter Beitrag: 05.09.05, 13:50 -
Optionen
Von Matrix Scripter im Forum Delphi, Kylix, PascalAntworten: 1Letzter Beitrag: 01.02.05, 21:56 -
SED Optionen
Von TobiTo im Forum Linux & UnixAntworten: 4Letzter Beitrag: 15.04.04, 18:28 -
Optionen ****?
Von Fist23 im Forum PhotoshopAntworten: 1Letzter Beitrag: 03.01.02, 21:54 -
PNG optionen
Von halo[one of three] im Forum PhotoshopAntworten: 0Letzter Beitrag: 17.09.01, 19:47





Zitieren
Login





