1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Permutation de deux valeurs - Fonction Javascript

abdelouafiOct 4, 2016

    1. abdelouafi

      abdelouafi Administrator Staff Member

      Messages:
      267
      Likes Received:
      8
      Trophy Points:
      18
      Joined
      Sep 13, 2016
      index.html :

      Code:
      <html>
      <head>
      <script language="javascript">
      function f(){
      <!--alert(document.fo.login.value);-->
      a=document.fo.login1.value
      document.fo.login1.value=document.fo.login2.value
      document.fo.login2.value=a
      <!-- document.fo.login.focus()-->
      }
      </script>
      </head>
      <body >
      <!--<input type="button" value="cliquez ici" onMouseOver="f()">-->
      <form name="fo">
      <input type="text" name="login1">
      <input type="text" name="login2">
      <input type="button" value="Permuter" onClick="f()">
      </form>
      </body>
      </html>
      TP numéro 2:
      Compteur à rebour avec Javascript
      Code html de la page compteur.html:
      Code:
      <html>
      <head>
      <script language="javascript">
      i=10;
      function f(){
      <!--alert(document.fo.login.value);-->
      a=setTimeout("f()",1000);
      document.fo.login1.value=i;
      i-=1
      if (i==-1){
      document.fo.login1.value="Bravo";
      clearTimeout(a);
      document.fo.login1.size="20";
      }
      <!-- document.fo.login.focus()-->
      }
      </script>
      </head>
      <body onLoad="f()">
      <!--<input type="button" value="cliquez ici" onMouseOver="f()">-->
      <form name="fo">
      <input type="text" value="10" name="login1" size="18" style=" border:solid 0px red;color:black;font:72pt monospace;text-align:center;"><br>
      <input type="button" value="Permuter" onClick="clearTimeout(a)">
      </form>
      </body>
      </html>
       
      Last edited: Dec 23, 2016
      Loading...

Share This Page

Share