Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Aplikacje internetowe</title>
- <meta http-equiv="Content-Language" content="pl">
- <meta http-equiv="Content-type" content="text/html"; charset= ISO-8859-2 />
- <meta http-equiv="content-script-type" content="text/javascript">
- </head>
- <body>
- <script type="text/javascript">
- var x=prompt("Podaj Imie i Nazwisko");
- var pesel=prompt("Podaj swoj ne pesel:")*1;
- function plec(pesel) {
- pesel_cyfry = String(pesel).split("").map(function(znak) {
- return parseInt(znak);
- })
- if (pesel_cyfry[9] % 2)
- return "mezczyzna";
- else
- return "kobieta";
- }
- function data_urodzenia(pesel) {
- rok = String(pesel).substr(0, 2);
- miesiac = String(pesel).substr(2, 2);
- dzien = String(pesel).substr(4, 2);
- return "19" + rok + "-" + miesiac + "-" + dzien;
- }
- function pesel_poprawny(pesel) {
- wagi = [9, 7, 3, 1];
- pesel_cyfry = String(pesel).split("").map(function(znak) {
- return parseInt(znak);
- })
- var suma_kontrolna = 0
- for (var i = 0; i < 10; i++)
- suma_kontrolna += pesel_cyfry[i] * wagi[i%4];
- return pesel_cyfry[pesel_cyfry.length-1] == suma_kontrolna%10;
- }
- document.write("",x);
- document.write("Data Urodzenia:",data_urodzenia);
- document.write("Płeć:",plec);
- document.write("Potawność Peselu",pesel_poprawny);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement