[HTML] Code überprüfen / Problem

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Benutze anstatt onblur lieber onChange.
    Und probiers mal so:

    HTML-Quellcode

    1. <form name="Test" action="">
    2. <select type="text" name="Eingabe" onChange="pruefeInhalt()">
    3. <option>An Alle</option>
    4. <option>Nur an User</option>
    5. <option>Nur an Administratoren</option>
    6. <option>An einzelnen User/Admin</option>
    7. </select>
    8. </form>
    9. <script type="text/javascript">
    10. function pruefeInhalt() {
    11. if(document.Test.Eingabe.selectedIndex == 1){ //An alle
    12. document.write("<big>hallo mein name ist... 1</big>");
    13. return false;
    14. }
    15. else if(document.Test.Eingabe.selectedIndex == 2){ //Nur an User
    16. document.write("<big>hallo mein name ist... 2</big>");
    17. return false;
    18. }
    19. else if(document.Test.Eingabe.selectedIndex == 3){ //Nur an Administratoren
    20. document.write("<big>hallo mein name ist... 3</big>");
    21. return false;
    22. }
    23. else if(document.Test.Eingabe.selectedIndex == 4){ //An einzelnen User/Admin
    24. document.write("<big>hallo mein name ist... 4</big>");
    25. return false;
    26. }
    27. }
    28. </script>
    Alles anzeigen
  • Das von Maddin hab ich mal getestet, klappt wunderbar:

    HTML-Quellcode

    1. <html>
    2. <head>
    3. <script type="text/javascript">
    4. function pruefeInhalt() {
    5. if(document.Test.Eingabe.selectedIndex == 1){ //An alle
    6. document.write("<big>hallo mein name ist... 1</big>");
    7. return false;
    8. }
    9. else if(document.Test.Eingabe.selectedIndex == 2){ //Nur an User
    10. document.write("<big>hallo mein name ist... 2</big>");
    11. return false;
    12. }
    13. else if(document.Test.Eingabe.selectedIndex == 3){ //Nur an Administratoren
    14. document.write("<big>hallo mein name ist... 3</big>");
    15. return false;
    16. }
    17. else if(document.Test.Eingabe.selectedIndex == 4){ //An einzelnen User/Admin
    18. document.write("<big>hallo mein name ist... 4</big>");
    19. return false;
    20. }
    21. }
    22. </script>
    23. </head>
    24. <body>
    25. <form name="Test" action="">
    26. <select type="text" name="Eingabe" onChange="pruefeInhalt()">
    27. <option>An Alle</option>
    28. <option>Nur an User</option>
    29. <option>Nur an Administratoren</option>
    30. <option>An einzelnen User/Admin</option>
    31. </select>
    32. </form>
    33. </body>
    34. </html>
    Alles anzeigen