jScript



  • Hallo

    Ich habe ein Problem, ich möchte wenn ich auf den Button klicke, das die E-Mail überprüft wird und das eine E-Mail enthalten ist.

    Momenten ist es so wenn ich auf den Button gehe, wird das Formular sofort gesendet. Um in die E-Mail kontrolle zu kommen muss ich erst in das Feld E-Mail einmal klicken.

    Hier der die seite die ich meine.

    !Die Funktion

    function CheckInhaltButton(Feld)

    müsste bearbeitet werden!!

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    	"http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <SCRIPT language=JavaScript type=text/javascript>
        <!--
    var nWin
    
    function CheckInhaltButton(Feld)
        {
    
        if (Feld == "")
        {
    		document.Formular.eMail.focus();
        	return false;
        }
        }
    
    function CheckInhaltEmail(Feld)
        {
    
        if (Feld == "")
        {
    		alert ("Bitte erst Ihre Email-Adresse eintragen!");
    		document.Formular.eMail.focus();
        	return false;
        }
        	else
        	{
        		/*Check eMail-Adresse formal*/
        		var chkZ1 = -1;
        		var chkZ2 = -1;
    
        			for (i=0;i<document.Formular.eMail.value.length;++i)
        			{
        				if (document.Formular.eMail.value.charAt(i) == ".")
        				chkZ1 = 1;
    				}
        					for (i=0;i<document.Formular.eMail.value.length;++i)
        					{
        						if (document.Formular.eMail.value.charAt(i) == "@")
        						chkZ2 = 1;
    						}
        						if (chkZ1 == -1 || chkZ2 == -1)
        						{
        							alert ("eMail-Adresse ohne '@' und '.' ist ungültig");
        							document.Formular.eMail.focus();
        							return false;
        						}
        						else
        						{
    								eMail = Feld
    								document.Formular.TelNr.focus();
    								return;
    							}
    		}
    
    }
    
    function endAbfrage() {
    	erg = confirm("Sind Sie sicher, dass Sie das Formular so jetzt abschicken wollen?")
    	if (erg == true) {	
    	    document.Formular.submit()
    	    nWin.close();
    	    }
    	else {
    	     return false;
    	     }		
    	} 
    
    function openWin() {
    	var erg
    	nWin = window.open("","Prüfung","menubar=yes,scrollbars=yes");
    	nWin.focus();
    	nDoc = nWin.document.open()	
    	nWin.document.write('<I> <B> Bitte prüfen Sie nochmals genau alle Angaben: </B> </I> <HR> <P>');
    
    	nWin.document.write(eMail + "<BR>");
    	nWin.document.write("Bestelltext:");
    	temp=document.getElementById("Beschreibung").value;
    	nWin.document.write(temp + "<P>");
    
    	nWin.document.write('<HR> Sollten noch Korrekturen notwendig sein, bitte auf "Abbrechen" clicken, ansonsten auf "OK" und damit abschicken. <P>'); 
    
    	nWin.document.write('<BODY> <CENTER> <INPUT type="button" name="EndAbf" value="Weiter" onClick="opener.endAbfrage()"> </CENTER> <P> </BODY>')
    
    	nWin.document.write("Falls das direkte Versenden mit Ihrem eMail-Programm nicht funktionieren sollte, bitte im Menü (Internet-Explorer) auf 'Datei' und dann 'Senden - Seite durch eMail...' clicken. Der Textteil wird dann automatisch in Ihre eMail-Vorlage als Attachment angefügt. <P>");	
    	eMailAdr = "XY" + unescape("%40") + "XY.de";
    	nWin.document.write("eMail-Adresse:  " + eMailAdr + "<BR> Betreff-Zeile: Bestellung <P> - und abschicken!");
    	return false;	
    }
    
    //-->
    </SCRIPT>
    
       <style>
    <!--
    .colorsub
    {
        COLOR: #6699CC;
        FONT-FAMILY: Arial,Helvetica,Geneva,Swiss,SunSans-Regular;
        FONT-SIZE: 15px;
        FONT-WEIGHT: bold;
        LINE-HEIGHT: 14pt;
        MARGIN-TOP: 9px
    }
    .plaintextColor
    {
        COLOR: #6699CC;
        FONT-FAMILY: Arial,Helvetica,Geneva,Swiss,SunSans-Regular;
        font-size: 12px;
    }
    -->
    </style>
    
    </head>
    
    <body id="page" onload="FP_preloadImgs(/*url*/'button9.jpg', /*url*/'buttonA.jpg'); init()">
    <font face="Arial">
    <!-- BEGIN PAGE HEADER -->
    </font>
    <font face="Arial">
    <!-- END PAGE HEADER -->
    
    <!-- BEGIN PAGE BODY-->
    
    <!-- BEGIN SIDE NAVIGATION WRAPPER-->
    </font>
    <table width="870">
      <tr>
        <td class="bodyColumn" width="68%">
    <font face="Arial">
    <!-- END SIDE NAVIGATION WRAPPER-->
    
    </font>
    
    <table id="pageBody" width="106%">
     <col class="main">
    
    <!-- BEGIN PAGE BODY TOP-->
    <!-- needs to be an own HTM modul since I need to call "Page_Body_Item" twice-->
    
    <!-- CENTRAL TOPIC-->
    <!--BEGIN PAGE BODY ITEM-->
    <tr class="topic">
      <td class="main" valign="top">
        									&nbsp;</td>
    </tr>
    <tr class="topic">
      <td class="main" valign="top" width="93%">
        										&nbsp;<!--<form action="/cgi-bin/mailmanager.pl" method="post"> --><FORM name=Formular onsubmit="return openWin()" method=post encType=text/plain>
        <p>
        <font face="Arial" color="#000080">
    	<input name="recipient" type="hidden" value="info@edvwl.de">
    	<input type="hidden" name="redirect" value="http://Vielen-Dank.html">
    	<input name="subject" type="hidden" value="infos. [Formular Nr.: 002]">
    	<input name="print_config" type="hidden" value="email,subject,realname">
    	<input name="sort" type="hidden" value="alphabetic"></font>
    
    	<span class="largeColor2">
    
    	<a name=top style="color: #6699CC; font-family: Geneva, Arial, Helvetica, Swiss, SunSans-Regular; font-weight: 700"></a>
    	</span><p>&nbsp;</p>
    	<table border="0" width="102%" id="table10">
    		<tr>
    			<td width="133">
    											<span class="largeColor2">
    											<a style="color: #6699CC; font-family: Geneva, Arial, Helvetica, Swiss, SunSans-Regular; text-decoration: none">
    											<font style="font-size: 12pt; font-weight: 700">
    											Adresse:</font><font style="font-size: 14pt; font-weight: 700" color="#FF0000">*</font></a></span></a></td>
    			<td><font face="Arial"><input name="eMail" TYPE="text" VALUE="" size="34" ONBLUR="CheckInhaltEmail(this.value)"></font>
                </a></td>
    		</tr>
    	</table>
    	<p>
    		<b><font size="4" face="Arial"><a target="_top" href="download.html">
    		<input ONBLUR="CheckInhaltButton(this.value)" type="image" border="0" id="img1" src="button8.jpg" height="31" width="155" alt="&gt;&gt;Absenden" fp-style="fp-btn: Simple Circle 1; fp-font: Arial; fp-font-size: 12; fp-font-color-normal: #8CAAE7" fp-title="&gt;&gt;Absenden" onmouseover="FP_swapImg(1,0,/*id*/'img1',/*url*/'button9.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img1',/*url*/'button8.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img1',/*url*/'buttonA.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img1',/*url*/'button9.jpg')" name="Absenden"></a></font></b><br>
    		<br>
    		<br>
    		<span class="largeColor2"><font size="2">
    		<a style="color: #6699CC; font-family: Geneva, Arial, Helvetica, Swiss, SunSans-Regular; text-decoration: none; font-weight: 700">
    		Die mit Sternchen(</a></font><a style="color: #6699CC; font-family: Geneva, Arial, Helvetica, Swiss, SunSans-Regular; text-decoration: none; font-weight: 700"><font color="#FF0000" size="2">*</font><font size="2">)</font><span style="font-family: Verdana; font-weight: 400">
    		</span><font size="2">gekennzeichneten Angaben sind Pflichtfelder.</font></a></span></p>
    
    </form>
    
      </td>
    </tr>
    <!--END PAGE BODY ITEM--><!-- END PAGE BODY TOP-->
    
    <!-- ALL OTHER TOPICS-->
    <!--BEGIN PAGE BODY ITEM--><!--END PAGE BODY ITEM-->
    
    <!-- BEGIN TOP BUTTON -->
    <tr class="topic">
      <td class="main" valign="top">
        <div class="body">
          <div class="topCommand">
            <font face="Arial">
            <span class="commands">
    	  <span class="command">
                <img src="Res/images/top_button.gif" alt=""> 
    	      <a href="java\1:scroll(0,0)">
    	         <span class="label">Seitenanfang</span>
                  </a>
     	</span>
           </span>
          	</font>
          </div>
        </div>
      </td>
    </tr>
    <!-- END TOP BUTTON -->
    
    </table>
    
    <font face="Arial">
    
    <!-- BEGIN SIDE NAVIGATION WRAPPER-->
        </font>
        </td>
      </tr>
    </table> 
    <font face="Arial"> 
    <!-- END SIDE NAVIGATION WRAPPER-->
    
    <!-- END PAGE BODY-->
    
    <!---BEGIN FOOTER-->
    </font>
    <table id="pageFooter">
       <tr>
         <td></td>
       </tr>
    </table>
    <font face="Arial">
    <!---END FOOTER-->
    
    </font>
    <p>&nbsp;</p>
    
    <SCRIPT type=text/javascript>
    <!--
    document.Formular.action = "mailto:XY" + unescape("%40") + "XY.de";
    document.Formular.Vorname.focus();
    //-->
    </SCRIPT>
    
    </body>
    </html>
    


  • Hallo

    Ich habe den script mal bearbeitet.
    Er Funktioniert leider nicht richtig.

    Wer kann mir den den script einmal verbessern bitte.

    Komplette HTML Code mit script...

    <SCRIPT language=JavaScript type=text/javascript>
        <!--
      var nWin
    
    function CheckInhaltEmail(Feld)
        {
    
        if (Feld == "")
        {
    		alert ("Bitte erst Ihre Email-Adresse eintragen!");
    		document.Formular.eMail.focus();
        	return false;
        }
        	else
        	{
        		/*Check eMail-Adresse formal*/
        		var chkZ1 = -1;
        		var chkZ2 = -1;
    
        			for (i=0;i<document.Formular.eMail.value.length;++i)
        			{
        				if (document.Formular.eMail.value.charAt(i) == ".")
        				chkZ1 = 1;
    				}
        					for (i=0;i<document.Formular.eMail.value.length;++i)
        					{
        						if (document.Formular.eMail.value.charAt(i) == "@")
        						chkZ2 = 1;
    						}
        						if (chkZ1 == -1 || chkZ2 == -1)
        						{
        							alert ("eMail-Adresse ohne '@' und '.' ist ungültig");
        							document.Formular.eMail.focus();
        							return false;
        						}
        						else
        						{
    								eMail = Feld
    								document.Formular.Weiter.focus();
    								return;
    							}
    		}
    
    }
    
    var nWin
    
    function endAbfrage() {
    	erg = confirm("Sind Sie sicher, dass Sie das Formular so jetzt abschicken wollen?")
    	if (erg == true) {	
    	    document.Formular.submit()
    	    nWin.close();
    	    }
    	else {
    	     return false;
    	     }		
    	} 
    
    function openWin() {
    	var erg
    	nWin = window.open("","Prüfung","menubar=yes,scrollbars=yes");
    	nWin.focus();
    	nDoc = nWin.document.open()	
    	nWin.document.write('<I> <B> Bitte prüfen Sie nochmals genau alle Angaben: </B> </I> <HR> <P>');
    	nWin.document.write(eMail + "<BR>");
    	nWin.document.write("Bestelltext:");
    	nWin.document.write(temp + "<P>");
    	nWin.document.write('<HR> Sollten noch Korrekturen notwendig sein, bitte auf "Abbrechen" clicken, ansonsten auf "OK" und damit abschicken. <P>'); 
    	nWin.document.write('<BODY> <CENTER> <INPUT type="button" name="EndAbf" value="Weiter" onClick="opener.endAbfrage()"> </CENTER> <P> </BODY>')
    	nWin.document.write("Falls das direkte Versenden mit Ihrem eMail-Programm nicht funktionieren sollte, bitte im Menü (Internet-Explorer) auf 'Datei' und dann 'Senden - Seite durch eMail...' clicken. Der Textteil wird dann automatisch in Ihre eMail-Vorlage als Attachment angefügt. <P>");
    	eMailAdr = "mo" + unescape("%40") + "edvwl.de";
    	nWin.document.write("eMail-Adresse:  " + eMailAdr + "<BR> Betreff-Zeile: Bestellung <P> - und abschicken!");
    
    	return false;	
    }
    
    //-->
    </SCRIPT>
    
    <FORM name=Formular onsubmit="return openWin()" method=post encType=text/plain>
    <font face="Arial" color="#000080">
    <input name="recipient" type="hidden" value="info@edvwl.de">
    <input type="hidden" name="redirect" value="http://www.edvwl.de/downloadseite/Vielen-Dank.html">
    <input name="subject" type="hidden" value="Bestellung der Demo oder Produktinfos. [Formular Nr.: 002]">
    <input name="print_config" type="hidden" value="email,subject,realname">
    <input name="sort" type="hidden" value="alphabetic"></font>
    
    <input name="eMail" TYPE="text" VALUE="" size="34" onClick="CheckInhaltEmail(this.value)" onblur="CheckInhaltEmail(this.value)"></font>
    <span class="largeColor2">
    
    <a style="color: #6699CC; font-family: Geneva, Arial, Helvetica, Swiss, SunSans-Regular; text-decoration: none; font-weight: 700">Wir setzen uns sofort mit Ihnen in Verbindung.</a></span></a></td>
    </tr>
    </table>
    <p> 
    <INPUT type=submit value=Weiter name=Weiter onClick="CheckInhaltEmail(this.value)">
    
    </form>
    

    Es komme mehrere Fehlermeldungen, jetzt auch wenn ich ins E-Mail Feld einmal klicke.


Anmelden zum Antworten