Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.98 KB | None | 0 0
  1. <html>
  2. <head>
  3. <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
  4. <meta NAME="Language" CONTENT="pl">
  5. <meta NAME="Author" CONTENT="hehexd">
  6. <title>Sprawdzian umiejętności - JavaScript - funkcje, gr. 2</title>
  7.        
  8.        
  9.             <script type="text/javascript">
  10.                 function welcome()                                                  //Prawy górny róg na zielono
  11.                 {
  12.                     document.write("<hr width='41%' align='right' color='green'>");
  13.                     document.write("<h1 align='right' style='color:green;'>Sprawdzian umiejętności - JavaScript- cz1</h2>");
  14.                     document.write("<h1 align='right'>GR 1</h2>");
  15.                     document.write("<hr width='41%' align='right' color='green'>");
  16.                    
  17.                 }
  18.                 function intro()                                                    //Środek na czerwono
  19.                 {
  20.                     document.write("<hr style='align='right' color='red'>");
  21.                     document.write("<h2 align='center' width='430px' style='color:red;'>Skrypt wykonany przez: Jan Kowalski, klasa: 3A. grupa: 2</h2>");
  22.                     document.write("<hr color='red'>");
  23.                 }
  24.                 function odstep()                                                   //Odstęp
  25.                 {
  26.                     document.write("<br>");
  27.                 }
  28.                
  29.                 function formularz()                                                //Liczby do obliczenia średniej -> Formularz/ Lekcaj 12
  30.                 {
  31.                     document.write("<form>");
  32.                     document.write("<h1>Obliczanie średniej</h1>");
  33.                     document.write("Podaj liczbę 1 : <input type='text' name='a' value=''>");
  34.                     odstep();
  35.                     document.write("Podaj liczbę 2 : <input type='text' name='b' value=''>");
  36.                     odstep();
  37.                     document.write("Podaj liczbę 3 : <input type='text' name='c' value=''>");
  38.                     odstep();
  39.                     document.write("Podaj liczbę 4 : <input type='text' name='d' value=''>");
  40.                     odstep();
  41.                     document.write("Podaj liczbę 5 : <input type='text' name='e' value=''>");
  42.                     odstep();
  43.                     document.write("<input type='button' name='oblicz' value='OBLICZ' onclick='licz(a.value, b.value, c.value, d.value, e.value)' >");
  44.                     document.write("</form>");
  45.                 }
  46.                 function srednia(a, b, c, d, e)                                     //Obliczanie średniej
  47.                 {
  48.                     return ((+a)+(+b)+(+c)+(+d)+(+e))/srednia.length;
  49.                 }
  50.                 function licz(liczba1, liczba2, liczba3, liczba4, liczba5)      //Wypisanie naszych 5 liczb i obliczenie średniej z funkcji srednia()
  51.                 {
  52.                     document.write("<hr width='41%' align='right' color='green'>");
  53.                     document.write("<h1 align='right' style='color:green;'>Sprawdzian umiejętności - JavaScript- cz1</h1>");
  54.                     document.write("<h1 align='right'>GR 1</h1>");
  55.                     document.write("<hr width='41%' align='right' color='green'>");
  56.                     odstep();
  57.                     document.write("<hr width='59%' align='left' color='#4286f4'>");
  58.                     document.write("<h4 style='color:#4286f4;'>Twoje liczby to: "+liczba1+", "+liczba2+", "+liczba3+", "+liczba4+", "+liczba5+"</h5>");
  59.                     document.write("<h3 style='color:#4286f4;'>Średnia tych liczb: "+srednia(liczba1, liczba2, liczba3, liczba4, liczba5)+"</h4>");
  60.                 }
  61.             </script>
  62.     </head>
  63.         <body>
  64.             <script type="text/javascript">
  65.                 welcome();
  66.                 odstep();
  67.                 intro();
  68.                 formularz();
  69.             </script>
  70.         </body>
  71. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement