utilisation de la fonction alert
bonjour voila mon script! jaimerai rajouter un test ki di ke si je ne rempli pa le champs "jenvoi" ba jai une alerte qui me demande de la remplir lorsque je clike sur le bouton envoyer.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Nouvelle page 1</title>
</head>
<body>
<script>
function change_action(name)
{
if (name == "gen")
{
if(nombre1 == '')
{
alert("remplir les champs");
<?
return(0);
?>
}
document.form.method="post";
document.form.action = "envoi4.php";
document.form.target="_blank";
}
else
{
document.form.action = "newsletter2.php";
document.form.method="post";
}
document.form.submit();
}
</script>
<form name="form">
<table cellpadding="10">
<tr>
<td width=261>j'envoi de</td>
<td><input name=nombre1 type=text ></input></td>
</tr>
<tr>
<td width=261>à</td>
<td><input name=nombre2 type=text ></input></td>
</tr>
<tr>
<td width=261>Nom de l'auteur:</td>
<td><input name=noma type=text></input></td>
</tr>
<tr>
<td width=261>Addresse de l'auteur:</td>
<td><input name=adda type=text value="alfa@beta.com input></td>
</tr>
<tr>
<td width=261>Sujet du message:</td>
<td><input name=sujet type=text value="alfa"></input></td>
</tr>
<tr><th colspan=3>
<textarea name=entete rows="9" cols="72"></textarea>
</th></tr>
<tr>
<th><input type=text name=titre1></input></th>
<th><input type=text name=titre2></input></th>
<th><input type=text name=titre3></input></th>
</tr><tr>
<th><textarea name=corps1 rows="9" cols="30"></textarea></th>
<th><textarea name=corps2 rows="9" cols="30"></textarea></th>
<th><textarea name=corps3 rows="9" cols="30"></textarea></th>
</tr><tr>
<th><input type=text name=pied1></input></th>
<th><input type=text name=pied2></input></th>
<th><input type=text name=pied3></input></th>
</tr>
<tr>
<th colspan=3><input type=text name=titrebas size="72"></input></th>
</tr>
<tr>
<th colspan=3>
<textarea name=pied rows="9" cols="72"></textarea><br/>
</th>
</tr>
</tr>
<tr><th align=right> lien 1:</th><th colspan=2>
<input type=text name=lien1 size="50"></input>
</th></tr>
<tr><th align=right height="47"> lien 2:</th><th colspan=2 height="47">
<input type=text name=lien2 size="50"></input>
</th></tr>
<tr><th align=right> lien 3:</th><th colspan=2>
<input type=text name=lien3 size="50"></input>
</th></tr>
<tr><th align=right> lien 4:</th><th colspan=2>
<input type=text name=lien4 size="50"></input>
</th></tr>
<tr><th align=right> lien 5:</th><th colspan=2>
<input type=text name=lien5 size="50"></input>
</th></tr>
<tr><th align=right> lien 6:</th><th colspan=2>
<input type=text name=lien6 size="50"></input>
</th></tr>
</tbody>
</table>
<input type=submit value="envoyer" name=gen onclick="change_action(this.name)"><br>
<input type=submit value="generer" name=gen2 onclick="change_action(this.name)">
</form>
</body>
</html> |