I need some help guys, i have to make a website for school, and i have 2 javascripts in them one is a google search engine and the second checks if the fields of the form arent empty, so when i click the “verzenden” button, and fields “naam” and/or “e-mail” are empty i should get a warning, well this works, but the moment i add the google search engine my previous script doesnt work anymore, plz help
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<!-- JAVASCRIPT FUNCTIE ONSUBMIT METHOD POST!-->
<script type="text/javascript">
function isEmpty(strfield1, strfield2, strfield3) {
strVeld1 = document.forms[0].naam.value
strVeld2 = document.forms[0].email.value
strVeld3 = document.forms[0].suggesties.value
if (strVeld1 == "" || strVeld1 == null || !isNaN(strVeld1) || strVeld1.charAt(0) == ' ')
{
alert("Je moet je naam nog invullen")
return false;
}
else if (strVeld2 == "" || strVeld2 == null || strVeld2.charAt(0) == ' ')
{
alert("Je moet je e-mail adres nog invullen")
return false;
}
else
{ return true; }
}
function isValidEmail(strEmail){
validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
strEmail = document.forms[0].email.value;
if (strEmail.search(validRegExp) == -1)
{
alert('Geef een correct email adres op');
return false;
}
return true;
}
function check(form){
if (isEmpty(form.field1)){
if (isEmpty(form.field2)){
if (isValidEmail(form.email)){
return true;
}
}
}
return false;
}
</script>
</head>
<body>
<!-- METHOOOOOOOD GET !-->
<FORM name="google" method="GET" action="http://www.google.com/search" >
<TABLE bgcolor="#FFFFFF"><tr><td>
<A HREF="http://www.google.com/"><IMG SRC="http://www.google.com/logos/Logo_40wht.gif" <br></A>
<INPUT TYPE=text name=q size=15 maxlength=255 value="">
<INPUT TYPE=hidden name=hl value="en"><BR>
<INPUT type=submit name=btnG VALUE="Google Search">
</td></tr></TABLE>
</FORM>
<!-- METHOOOOOOOD POST !-->
<form name="contact" method="post" onsubmit="return Check(this);" action="mailto:browsers@mrbiggles.be?subject=Suggestie" enctype="text/plain" >
<Table border=0>
<h2>Contactformulier</h2>
<TR>
<TD><label for="naam">Naam:</label></TD>
<TD><input name="naam" type="text" class="tekstveld"/><br /></TD>
</TR>
<TR>
<TD><label for="email">E-mail adres:</label></TD>
<TD><input type="text" name="email" class="tekstveld"/><br /></TD>
</TR>
</TABLE>
<BR><BR>
<table border=0>
<TR><TD><h2>Hoe vond u de informatie die de site u toereikte?</h2></TD></TR>
<TR>
<TD>
<input type="radio" name="indruk" value="Zeer slecht">Zeer slecht
<input type="radio" name="indruk" value="Slecht">Slecht
<input type="radio" name="indruk" value="Middelmatig" checked="true">Middelmatig
<input type="radio" name="indruk" value="Goed">Goed
<input type="radio" name="indruk" value="Uitstekend">Uitstekend<br/>
</TD>
</TR>
<TR><TD><BR><BR></TD></TR>
<TR>
<TD><h2>Heeft u nog suggesties?</h2></TD>
</TR>
<TR>
<TD><textarea name="suggesties" cols="70" rows="10"></textarea><br /></TD>
</TR>
<TR>
<TD>
<input type="submit" value="Formulier verzenden" class="knoppen"/>
<input type="reset" name="lol" value="Leegmaken" class="knoppen"/>
</TD>
</TR>
</TABLE>
</form>
</body>
</html>