![]() |
![]() |
|
![]() |
![]() |
|
Programmierung Rat & Tat für Programmierer |
![]() |
|
Themen-Optionen | Ansicht |
![]() |
#1 |
Inventar
![]() Registriert seit: 13.06.2001
Beiträge: 1.830
|
![]() Ich verwende um alle Elemente einse Formulars zu durchlaufen den Code
for (var i=0; i<document.drake.elements.length; i++) { document.writeln(i); } Bei mir kommt allerdings die Fehlermeldung documents.formular.elements ist null oder kein Objekt. Ich habe das Formular weiter unten im Quelltext mit <form name="formular"> ... </form> aber richtig definiert. Weiß wer worans liegt? Jak
____________________________________
Join the DNRC | Godwin\'s Law (thx@stona) Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing. \"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra) |
![]() |
![]() |
![]() |
#2 |
Inventar
![]() Registriert seit: 06.04.2001
Alter: 44
Beiträge: 2.343
|
![]() soweit ich das erkenne, nennst du dein formular in html "formular", willst aber in js auf ein formular namens "drake" zugreifen. und noch was: nach elements müßtest du doch den namens des formularelementes angeben, dessen länge du auslesen möchtest, oder?
____________________________________
"Life is like a box of rockets," said the Marine. "You never know what you´re gonna ret." Then he pulled the trigger of his BFG9000. |
![]() |
![]() |
![]() |
#3 |
Inventar
![]() Registriert seit: 13.06.2001
Beiträge: 1.830
|
![]() Der Namensfehler ist nicht in der html seite drinnen, denn hab ich reingeschusselt.
Wegen elements.length: .length speichert die Anzahl der Einträge in einem Array. Und für den Browser ist elements ein Array in dem alle Formular Felder+Knöpfe gespeichert werden. Was mich stutzig macht ist, daß das selbe Formular auf einer anderen Seite funktioniert. Dort schauts so aus: (Ist ein gräulicher quelltext; Jugendsünde ![]() <script language="JavaScript" type="text/javascript"> <!-- function alle(das,a,b) { var was; if (das==1) was="an_" else if (das==2) was="cc_" else was="bcc_"; for (var i=0; i<document.auswahl.elements.length; i++) { var pos = document.auswahl.elements[i]; if (pos.name.indexOf(was)==0) { pos.checked = true; document.auswahl.elements[i+a].checked = false; document.auswahl.elements[i+b].checked = false; } } window.location.href="#button"; } function adressaten() { var an="", bcc="", cc="", n_an="", n_cc="", n_bcc="", trigger=0; for (var i = 0; i < document.auswahl.elements.length; i++) { var pos=document.auswahl.elements[i]; if ( (pos.name.indexOf('an_')==0) && pos.checked && (an.indexOf(pos.value)==-1)) { if (an == "") { an = document.auswahl.elements[i-1].value; n_an = document.auswahl.elements[i-1].name; } else { an = an + ";" + document.auswahl.elements[i-1].value; n_an = n_an + "; " + document.auswahl.elements[i-1].name; } } if ( (pos.name.indexOf('cc_')==0) && pos.checked && (cc.indexOf(pos.value)==-1)) { if (cc == "") { cc = document.auswahl.elements[i-2].value; n_cc = document.auswahl.elements[i-2].name; } else { cc = cc + ";" + document.auswahl.elements[i-2].value; n_cc = n_cc + "; " + document.auswahl.elements[i-2].name; } } if ( (pos.name.indexOf('bcc_')==0) && pos.checked && (bcc.indexOf(pos.value)==-1)) { if (bcc == "") { bcc = document.auswahl.elements[i-3].value; n_bcc = document.auswahl.elements[i-3].name; } else { bcc = bcc + ";" + document.auswahl.elements[i-3].value; n_bcc = n_bcc + "; " + document.auswahl.elements[i-3].name; } } } e_mail(an, cc, bcc, n_an, n_cc, n_bcc); } function e_mail(an, cc, bcc, n_an, n_cc, n_bcc) { var alles, slash="/"; alles="<form name=\"mail_schicken\" method=\"post\" action=\"mailto:"; if (an != "") alles = alles + an; if (cc != "") alles = alles + "?cc=" + cc; if (bcc != "") alles = alles + "?bcc=" + bcc; alles = alles + "\" enctype=\"text/plain\" "+ "onsubmit=javascript:window.location.href=\"bestae ti/best_all.htm\">"; if (an=="" && cc=="" && bcc=="") alert("Sie haben keine Addressaten ausgewählt, Bitte wählen sie mindestens einen Addressaten aus"); else { document.writeln("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"); document.writeln(); document.writeln("<html>"); document.writeln("<head>"); document.writeln("<title>"+ "E-Mail Schritt 2"+ "</title>"); document.writeln("</head>"); document.writeln(); document.writeln("<body bgcolor=\"#ff6600\">"); document.write("<a href=\"start.htm\">"); document.write("Name der Seite" + "</a>" ); document.write("/ "+ "<a href=\"an_alle.htm\">"); document.write("E-Mail an alle, Schritt 1"+ "</a>"); document.writeln("/ E-Mail an alle, Schritt 2"); document.writeln(" "); document.writeln(); document.writeln(alles); document.writeln(" <fieldset>"); document.write(" <legend>"); document.writeln("Schritt 2 von 2"+ "</legend>"); document.writeln(" <table align=\"center\">"); document.writeln(" <tr>"); document.write(" <td>An:"); document.writeln("</td>"); document.writeln(" <td>" + n_an+ "</td>"); document.writeln(" </tr><tr>"); document.write(" <td>" + "CC:"); document.writeln("</td>"); document.writeln(" <td>" + n_cc+ "</td>"); document.writeln(" </tr><tr>"); document.write(" <td>"); document.writeln("BCC:</td>"); document.writeln(" <td>" + n_bcc + "</td>"); document.writeln(" </tr><tr>"); document.writeln(" <td colspan=\"2\" align=\"center\">"); document.write(" "<textarea rows=\"12\" cols=\"50\" name=\"a\">"); document.writeln("</textarea></td>"); document.write(" </tr><tr><td>"); document.writeln("</td>"); document.write(" </tr><tr><td>"); document.writeln("</td></tr><tr>"); document.write(" <td colspan=\"2\" align=\"center\">"); document.writeln("<input type=\"submit\" value=\"E-Mail abschicken\"></td>"); document.writeln(" </tr>"); document.writeln(" </table>"); document.writeln(" </fieldset>); document.writeln("</form>"); document.writeln(); document.writeln("</body>"); document.writeln("</html>"); } } // --> </script>
____________________________________
Join the DNRC | Godwin\'s Law (thx@stona) Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing. \"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra) |
![]() |
![]() |
![]() |
#4 |
Inventar
![]() Registriert seit: 13.06.2001
Beiträge: 1.830
|
![]() Fortsetzung:
Das ganze ist in dem obigen Fall ein Mailformular. edit: das ganze geht dann so weiter </head> <body bgcolor="#ff6600"> Name der Seite / E-Mail an alle, Schritt 1 <div align="center"> <h1>E-Mail an Mitglieder</h1> <form name="auswahl" method="POST" action="javascript:adressaten()"> <fieldset name="b"> <legend>Schritt 1 von 2</legend> <table border style="border-style:solid; border-width:thin"> <tr> <th>An</th><th>CC:</th><th>BCC:</th><th>Name</th><th>E-Mail Adresse</th> </tr><tr> </tr><tr> <td><input type="button" name="alle_an" value="Alle" OnClick="alle(1,1,2)"></td> <td><input type="button" name="alle_cc" value="Alle" OnClick="alle(2,1,-1)"></td> <td><input type="button" name="alle_bcc" value="Alle" OnClick="alle(3,-1,-2)"></td> <td></td><td></td> </tr><tr> <td><input type="hidden" name="Name" value="erste@emailadresse"> <input type="checkbox" name="an_Name"></td> <td><input type="checkbox" name="cc_Name"></td> <td><input type="checkbox" name="bcc_Name"></td> <td>Name</td> <td>erste@emailadresse</td> </tr> usw. </table> </body> </html> P.S.: Wenn du zu dem zweiten Script einen Verbesserungsvorschlag hast, nur zu! Jak
____________________________________
Join the DNRC | Godwin\'s Law (thx@stona) Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing. \"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra) |
![]() |
![]() |
![]() |
#5 |
Inventar
![]() Registriert seit: 06.04.2001
Alter: 44
Beiträge: 2.343
|
![]() sorry, bin schon beim 1. teil eingeschlafen.
![]() der html-qt ist winwordgeneriert, oder?
____________________________________
"Life is like a box of rockets," said the Marine. "You never know what you´re gonna ret." Then he pulled the trigger of his BFG9000. |
![]() |
![]() |
![]() |
#6 |
Inventar
![]() Registriert seit: 24.09.2001
Beiträge: 7.335
|
![]() Der Code hätte dorthin gehört: http://www.wcm.at/vb2/showthread.php?s=&threadid=32227
![]()
____________________________________
Weiterhin zu finden auf http://martin.leyrer.priv.at , http://twitter.com/leyrer , http://www.debattierclub.net/ , http://www.tratschen.at/ und via Instant Messaging auf Jabber: m3 <ät> cargal.org . |
![]() |
![]() |
![]() |
#7 |
Inventar
![]() Registriert seit: 06.04.2001
Alter: 44
Beiträge: 2.343
|
![]() winword-qt oder schafe zählen, beides hilft, man schläft garantiert ein.
____________________________________
"Life is like a box of rockets," said the Marine. "You never know what you´re gonna ret." Then he pulled the trigger of his BFG9000. |
![]() |
![]() |
![]() |
#8 |
Inventar
![]() Registriert seit: 13.06.2001
Beiträge: 1.830
|
![]() Sorry. Ist veilleicht doch etwas trocken geworden.
@Rastlin Majere: Nope. Wordpad rult! ![]() Zum Fehlersuchen habe ich dann aber 1stpage verwendet. Im Editor war mir das dann doch zu blöd. Jak
____________________________________
Join the DNRC | Godwin\'s Law (thx@stona) Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing. \"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra) |
![]() |
![]() |
![]() |
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
|
|