Advertisement
amine99

Untitled

Mar 15th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.66 KB | None | 0 0
  1. <html>
  2.     <head>
  3.         <title>Exercice 5</title>
  4.         <script>
  5.             function Min(x,y) {
  6.                 if(x > y) return y;
  7.                 else return x;
  8.             }
  9.             function verify(s1,s2) {
  10.                 for(i = 0 ; i < Min(s1.length,s2.length) ; i++) {
  11.                     if(s1[i] != s2[i])
  12.                         return false;
  13.                 }
  14.                 return true;
  15.             }
  16.             function check() {
  17.                 s1 = F.T1.value;
  18.                 s2 = F.T2.value;
  19.                 if(verify(s1,s2))
  20.                     alert("Vrai");
  21.                 else
  22.                     alert("Faux");
  23.             }
  24.         </script>
  25.     </head>
  26.     <body>
  27.         <form name="F">
  28.             Chaine1 : <input type="text" name="T1"><br>
  29.             Chaine2 : <input type="text" name="T2"><br>
  30.             <input type="button" value="Verifier" onclick="check()">
  31.         </form>
  32.     </body>
  33. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement