Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
- <meta NAME="Language" CONTENT="pl">
- <meta NAME="Author" CONTENT="hehexd">
- <title>Sprawdzian umiejętności - JavaScript - funkcje, gr. 2</title>
- <script type="text/javascript">
- function welcome() //Prawy górny róg na zielono
- {
- document.write("<hr width='41%' align='right' color='green'>");
- document.write("<h1 align='right' style='color:green;'>Sprawdzian umiejętności - JavaScript- cz1</h2>");
- document.write("<h1 align='right'>GR 1</h2>");
- document.write("<hr width='41%' align='right' color='green'>");
- }
- function intro() //Środek na czerwono
- {
- document.write("<hr style='align='right' color='red'>");
- document.write("<h2 align='center' width='430px' style='color:red;'>Skrypt wykonany przez: Jan Kowalski, klasa: 3A. grupa: 2</h2>");
- document.write("<hr color='red'>");
- }
- function odstep() //Odstęp
- {
- document.write("<br>");
- }
- function formularz() //Liczby do obliczenia średniej -> Formularz/ Lekcaj 12
- {
- document.write("<form>");
- document.write("<h1>Obliczanie średniej</h1>");
- document.write("Podaj liczbę 1 : <input type='text' name='a' value=''>");
- odstep();
- document.write("Podaj liczbę 2 : <input type='text' name='b' value=''>");
- odstep();
- document.write("Podaj liczbę 3 : <input type='text' name='c' value=''>");
- odstep();
- document.write("Podaj liczbę 4 : <input type='text' name='d' value=''>");
- odstep();
- document.write("Podaj liczbę 5 : <input type='text' name='e' value=''>");
- odstep();
- document.write("<input type='button' name='oblicz' value='OBLICZ' onclick='licz(a.value, b.value, c.value, d.value, e.value)' >");
- document.write("</form>");
- }
- function srednia(a, b, c, d, e) //Obliczanie średniej
- {
- return ((+a)+(+b)+(+c)+(+d)+(+e))/srednia.length;
- }
- function licz(liczba1, liczba2, liczba3, liczba4, liczba5) //Wypisanie naszych 5 liczb i obliczenie średniej z funkcji srednia()
- {
- document.write("<hr width='41%' align='right' color='green'>");
- document.write("<h1 align='right' style='color:green;'>Sprawdzian umiejętności - JavaScript- cz1</h1>");
- document.write("<h1 align='right'>GR 1</h1>");
- document.write("<hr width='41%' align='right' color='green'>");
- odstep();
- document.write("<hr width='59%' align='left' color='#4286f4'>");
- document.write("<h4 style='color:#4286f4;'>Twoje liczby to: "+liczba1+", "+liczba2+", "+liczba3+", "+liczba4+", "+liczba5+"</h5>");
- document.write("<h3 style='color:#4286f4;'>Średnia tych liczb: "+srednia(liczba1, liczba2, liczba3, liczba4, liczba5)+"</h4>");
- }
- </script>
- </head>
- <body>
- <script type="text/javascript">
- welcome();
- odstep();
- intro();
- formularz();
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement