By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,911 Members | 1,177 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,911 IT Pros & Developers. It's quick & easy.

problem function validate

P: n/a
I am not good in Javascript I begin I do not understand why my function does
not go I post my code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>contact.html</title>
<meta name="generator" content="Bluefish 1.0.7">
<meta name="author" content="swilting">
<meta name="date" content="2007-02-09T13:41:56+0100">
<meta name="copyright" content="">
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type"
content="application/xhtml+xml; charset=UTF-8">
<meta http-equiv="content-style-type" content="text/css">
<meta http-equiv="expires" content="0">
<meta http-equiv="refresh" content="5; URL=http://">

</head>
<script type="application/x-javascript">
function validate()
{
if(document.info.nom.value=="")
{
alert("vous devez entrer votre nom.")
return false
}
if(document.info.prenom.value=="")
{
alert("vous devez entrer votre prenom.")
return false
}
if(document.info.mail.value=="")
{
alert("vous devez entrer votre mail.")
return false
}
if(document.info.body.value==")
{
alert("vous devez ecrire du texte dans le mail.")
return false
}
}

//-->
</script>
<body>

<table style="width: 100%;text-align: center;" border="1"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;"><img
src="http://localhost/cgi-bin/random_image.cgi" align="middle"
border="0"><br>
</td>
</tr>
</tbody>
</table>
<br>
<hr style="width: 100%; height: 2px;"><br>
<table style="width: 100%;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<form name="info" onsubmit="return validate()"
action="http://localhost/cgi-bin/mailperso.cgi" method="post"
enctype="multipart/form-data">
<br>
<hr style="width: 100%; height: 2px;"><br>
<p>vous pouvez m envoyer des e-mails personnalises pour que je travaille sur
vous idees</p>
<p>nom [obligatoire]</p>
<p></p>
<input type="text" name="nom" size="100" maxlength="100">
<p></p>
<p>prenom [obligatoite]</p>
<p></p>
<input type="text" name="prenom" size="100" maxlength="100">
<p></p>
<p>adresse mail [pas obligatoire]</p>
<input type="text" name="mail" size="100" maxlength="100">
<P>vous pouvez envoyer des images au format gif [pas obligatoire]</p>
<input type="file" name="attachement" size="50" maxlength="50">
<p>entrer le maximum d'information pour que l artiste travaille sur vos
idees</p>
<p>si vous n'avez pas remplie le champ mail indiquer votre numero de
telephone</p>
<textarea name="body" rows="5" cols="50"></textarea>
<p><input type="submit"></p>
</form><br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body>
</html>

Feb 9 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
john.swilting wrote:
I am not good in Javascript I begin I do not understand why my function does
not go I post my code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>contact.html</title>
<meta name="generator" content="Bluefish 1.0.7">
<meta name="author" content="swilting">
<meta name="date" content="2007-02-09T13:41:56+0100">
<meta name="copyright" content="">
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type"
content="application/xhtml+xml; charset=UTF-8">
<meta http-equiv="content-style-type" content="text/css">
<meta http-equiv="expires" content="0">
<meta http-equiv="refresh" content="5; URL=http://">

</head>
<script type="application/x-javascript">
function validate()
{
if(document.info.nom.value=="")
{
alert("vous devez entrer votre nom.")
return false
}
if(document.info.prenom.value=="")
{
alert("vous devez entrer votre prenom.")
return false
}
if(document.info.mail.value=="")
{
alert("vous devez entrer votre mail.")
return false
}
if(document.info.body.value==")
if(document.info.body.value=="")

Mick
{
alert("vous devez ecrire du texte dans le mail.")
return false
}
}

//-->
</script>
<body>

<table style="width: 100%;text-align: center;" border="1"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;"><img
src="http://localhost/cgi-bin/random_image.cgi" align="middle"
border="0"><br>
</td>
</tr>
</tbody>
</table>
<br>
<hr style="width: 100%; height: 2px;"><br>
<table style="width: 100%;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<form name="info" onsubmit="return validate()"
action="http://localhost/cgi-bin/mailperso.cgi" method="post"
enctype="multipart/form-data">
<br>
<hr style="width: 100%; height: 2px;"><br>
<p>vous pouvez m envoyer des e-mails personnalises pour que je travaille sur
vous idees</p>
<p>nom [obligatoire]</p>
<p></p>
<input type="text" name="nom" size="100" maxlength="100">
<p></p>
<p>prenom [obligatoite]</p>
<p></p>
<input type="text" name="prenom" size="100" maxlength="100">
<p></p>
<p>adresse mail [pas obligatoire]</p>
<input type="text" name="mail" size="100" maxlength="100">
<P>vous pouvez envoyer des images au format gif [pas obligatoire]</p>
<input type="file" name="attachement" size="50" maxlength="50">
<p>entrer le maximum d'information pour que l artiste travaille sur vos
idees</p>
<p>si vous n'avez pas remplie le champ mail indiquer votre numero de
telephone</p>
<textarea name="body" rows="5" cols="50"></textarea>
<p><input type="submit"></p>
</form><br>
</td>
</tr>
</tbody>
</table>
<br>
<br>
</body>
</html>
Feb 9 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.