Page 1088 - IT2
P. 1088
Question 1 (6 pts) : code html et code javascript.
Page. html (2 pts)
Voici une proposition de solution:
<html>
<head>
<title>Page</title>
</head>
<body>
<form name="formMail" action="#">
<pre>
<label>numero </label>: <input name="Text1" type="text" />
<label>nom </label> : <input name="Text2" type="text" />
<label> prenom </label> : <input name="Text3" type="text" />
<label> choisir une filiere</label> :
<input name="Radio1" type="radio" value='TDM'/>TDM
<input name="Radio1" type="radio" value='TDI'/>TDI
<input name="Radio1" type="radio" value='TRI'/>TRI
<label>adresse</label><textarea id="TextArea1" cols="20"
rows="2"></textarea>
<label>email</label>:<input name="email" type="text" />
<input type="button" name="but" value="valider" onclick="controlMail(formMail)">
/><input id="Reset1" type="reset" value="reset" />
</pre>
</form>
</body>
</html>
code javascript : Voici une proposition de solution: (4 pts)
<script language="JavaScript">
function controlMail(formS)
{
var adresse=formS.email.value;
var aro=adresse.charAt(3);
var point=adresse.charAt(8);
if(aro!="@" || point!="."
||adresse.length!=12||(adresse.indexOf("@")<>adresse.lastIndexOf("@"))||(adresse.indexOf(".")<>
adresse.lastIndexOf(".")))
{
alert("adresse incorrecte");
}
else
3/5
www.itlearning-settat.com
Email: admission@itlearning-settat.com
Tél.:0661077812

