andreas: AK proudly presents:

Beitrag lesen

Hallo!
Wollte schon wieder 2 neue Postings schreiben, aber jedesmal ist mir beim Schreiben noch eine letzte Idee gekommen, und die war jedesmal richtig ;-)
Aber ich hasse Javascript immer noch, irgendwie komme ich z.B. mit php sehr viel besser klar!

Jedenfalls hier das Ergebnis, das alles kann was ich wollte, was dagegen einzuwenden?

<head>
<script type="text/javascript">
<!--
function hinzufuegen() {
 for(var i=1;i<=document.formular.alle.length;i++) {
   if(document.formular.alle.options[i-1].selected == true){
 NeuerEintrag = new Option(document.formular.alle.options[i-1].value,document.formular.alle.options[i-1].value,false,true);
 document.formular.auswahl.options[document.formular.auswahl.length] = NeuerEintrag;}}
 document.formular.alle.value = "";
 document.formular.auswahl.value = "";
}

function loeschen()
{

for(var i=document.formular.auswahl.length;i>0;i--) {
  if(document.formular.auswahl.options[i-1].selected == true){
  document.formular.auswahl.options[i-1] = null;}
  }
}

function allesloeschen()
{
  for(var i=document.formular.auswahl.length;i>0;i--) {
    document.formular.auswahl.options[i-1] = null;
  }
}

//-->
</script>
</head>
<body>
<form name="formular" method="post" action="ausw.php">
  <select name="alle" size="5" multiple>
    <option value="a">a</option>
    <option value="b">b</option>
    <option value="c">c</option>
    <option value="d">d</option>
    <option value="e">e</option>
  </select>
  <input type="button" name="add" value="hinzufügen" onClick="hinzufuegen()">
  <input type="button" name="del" value="löschen" onClick="loeschen()">
  <input type="button" name="del2" value="alles löschen" onClick="allesloeschen()">
  <select name="auswahl" size="5" multiple>
  </select>
  <input type="submit" name="del22" value="abschicken">
</form>
</body>

Vielen Dank für Deine Hilfe!

Grüsse
  Andreas