return false Seite verhindern

-Ener-

Erfahrenes Mitglied
Hallo habe ein Formular welches in einem Popup abgesendet wird... vorher wird geprüft ob alle Felder eingetragen sind...wenn nicht gibt er einen alert aus. Nun das funktioniert auch soweit gut aber jedes mal wenn der alert kommt und man auf ok klickt öffnet sich ne leere seite wo einfach nur "false" steht... das möcht ich unterbinden... es soll sich gar keine Seite öffnen...


Script:


HTML:
<link rel="stylesheet" href="style.css" type="text/css">
<br>
<table cellspacing=0 cellpadding=0 border=0><tr><td><IMG SRC=contact.gif WIDTH=30 HEIGHT=30 BORDER=0> </td><td valign=bottom width=100%><table width=92%><td width=100% ><span style=font-family:verdana;font-size:8pt><b>Kontakt</b></table></td></td></tr></table><br><span style=font-family:verdana;font-size:8pt>Über dieses Formular können sie Kontakt mit dem Webmaster aufnehmen! Wir bitte sie alle alle Felder wahrheitsgemäß auszufüllen.
 
<script language="JavaScript">
function check() {
	if (document.contact.Name.value == "") {
		alert ("Bitte geben sie einen Namen ein");
		return false;
	}
	if (document.contact.Email.value == ""){
		alert("Bitte geben sie ihre E-Mailadresse an");
		return false;
	}
   {window.open('', 'popup', 'width=300, height=300');
	document.contact.submit();
 location.reload(url="index.php");
}
}

	
</script>
<form name="contact" action="contact.php" target="popup" method="post">
<table align="left" border="0" cellspacing="0" cellpadding=2><tr><td><span style="font-family:Verdana;font-size:8pt;font-color:black">Name:</td>
<td><input type=text name="Name" style="height:20px;width:100px;background:ffffff;border:1px;border-style:dashed;" onmousedown="style.backgroundColor='F3F9FE';" onmouseover="style.backgroundColor='F3F9FE';" onmouseout="style.backgroundColor='ffffff';"></td></tr><tr><td><span style="font-family:Verdana;font-size:8pt;font-color:black">E-Mail:</td><td><input type=text name="Email" style="height:20px;width:150px;background:ffffff;border:1px;border-style:dashed"  onmousedown="style.backgroundColor='F3F9FE';" onmouseover="style.backgroundColor='F3F9FE';"  onmouseout="style.backgroundColor='ffffff';"></td></tr><tr><td><span style="font-family:Verdana;font-size:8pt;font-color:black">Kontaktart:</span></td><td><SELECT NAME="Kontaktart" class="select" size=1 onmousedown="style.backgroundColor='F3F9FE';" onmouseup="style.backgroundColor='ffffff';" onmouseout="style.backgroundColor='ffffff';" ><option value="Frage">Frage</option><option value="Anregung">Anregung</option><option value="Beschwerde">Beschwerde</option><option value="Sonstige">Sonstige</option>

</SELECT></td></tr><tr><td valign="top"><span style="font-family:Verdana;font-size:8pt;font-color:black">Text:</span></td><td><textarea name="Text" rows="8" cols="30" style="background:ffffff;border:1px;border-style:dashed;overflow:auto"  onmousedown="style.backgroundColor='F3F9FE';" onmouseover="style.backgroundColor='F3F9FE';" onmouseout="style.backgroundColor='ffffff';"></textarea></td></tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:check()" name="submit" onmouseover= status='abschicken';return true; ><span style= "font-family:verdana;font-size:7.5pt"><b>abschicken</b></span></a></td></tr></table>

Bei Scriptfehlern bitte Bescheid geben! Danke
 
Wenn du eine JS-Funktion per href="javascript:funktion()" aufrufst, darf diese Funktion keinen Rückgabewert haben, sonst tritt der beschriebene Effekt auf.
Lasse das "false" weg... das brauchst du da nicht....und dann sollte es gehen.
 
Zurück