debuggage de Fonctions javascript
Bonjour à tous
les fonctions de javascript de mon formulaire ne marche plus
alors quand j'execute le formulaire appare mes fonctions marchent bien
avec ce code mes fonctions tournent bien
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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
<head>
<script type="text/javascript">
function changeBackgroundColor(elemnt)
{
if (elemnt) {
elemnt.style.backgroundColor = "yellow";
}
return;
}
function verify()
{
tt = document.getElementsByTagName("form");
if (tt[0].Code.value=="")
{
alert("Saisir Votre Code SVP!");
tt[0].Code.focus();
changeBackgroundColor(document.clientform.Code);
return false;
}
else
{
document.clientform.action="Enseignant.php?mode=control";
document.clientform.submit();
return true;
}
}
function ajout()
{
chp = document.getElementsByTagName("form");
if (chp[0].CodE.value=="" || chp[0].NomE.value=="" || chp[0].PrenE.value=="" || chp[0].AdrE.value=="" || chp[0].ViE.value=="" || chp[0].TelE.value=="" || chp[0].emailE.value=="")
{
alert("Remplir tous les champs SVP!");
chp[0].CodE.focus();
changeBackgroundColor(document.clientform2.CodE);
return false;
}
else
{
if (isNaN(chp[0].TelE.value))
{
alert("Numero Invalide!");
chp[0].TelE.focus();
changeBackgroundColor(document.clientform2.TelE);
return false;
}
else
{
document.clientform2.action="Enseignant.php?mode=add";
document.clientform2.submit();
return true;
}
}
}
</script>
<style type="text/css"><!--
.bold_right {font-weight: bold; text-align: right;}
.gray_banner { font-weight: bold; color: white;
background-color: gray;
text-align: center; font-size: 3em;}
.bold_large {font-size: 1.1em; font-weight: bold;}
-->
</style>
</head>
<table border="0" cellpadding="5" cellspacing="0">
<tr><td colspan="3" class="gray_banner">
Enseignant ou futurs enseignants</td></tr>
<tr><td width="40%" valign="top" class="bold_large">
Etes-vous déja membre ?
<br><br><br><br><br>
<form name="clientform" method="post" action="index.php?page=best.htm">
<p><table border="0">
<tr>
<td><font color="#FF3300">Veuillez saisir le code de sécurité:</font></td>
<td><input type="text" name="Code"></td>
</tr>
<tr>
<td style="text-align: center" colspan="2">
<br><input type="button" value="Identifiez-vous" onClick="verify();"></td>
</tr>
</table>
</td>
<td style="width: 1; background-color: gray"></td>
<td style="width: 70%"><p>
<span class="bold_large"></p>
<!-- formulaire à renseigner par les nouveaux membres -->
<form name="clientform2" method="post" action="index.php?page=best.htm">
<table border="0" width="100%">
<tr><td class="bold_right">Code Enseignant</td>
<td><input type="text" name="CodE"
size="20" maxlength="20"></td></tr>
<tr><td class="bold_right">Nom</td>
<td><input type="text" name="NomE"
size="20" maxlength="20"></td></tr>
<tr><td class="bold_right">Prenom</td>
<td><input type="text" name="PrenE"
size="20" maxlength="20"></td></tr>
<tr><td class="bold_right">Adresse</td>
<td><input type="text" name="AdrE"
size="20" maxlength="20"></td></tr>
<tr><td class="bold_right">Ville</td>
<td><input type="text" name="ViE"
size="20" maxlength="20"></td></tr>
<tr><td class="bold_right">Telephone</td>
<td><input type="text" name="TelE"
size="15" maxlength="20"></td></tr>
<tr><td class="bold_right">Adresse Email</td>
<td><input type="text" name="emailE"
size="55" maxlength="67"></td></tr>
<tr>
<td style="text-align: center" colspan="2">
<input type="button" value="Enregistrez-vous" onClick="ajout();" >
<input type="reset" style="text-align: center" value ="Rétablir" ></td>
</tr>
</table>
</form>
</td>
</tr>
<tr><td colspan="3"
style="background-color: gray"> </td></tr>
</table>
<div style="text-align: center; font-size: .8em">
Nous apprécierions vos commentaires et suggestions. Vous pouvez
les adresser a <a href="mailto:@gmail.com">
X@gmail.com</a></div> |
mais quand j'execute ce formulaire dans cette page rien ne marche
:bug:
Merci de votre Aide