Advertisement
Guest User

Prompt3

a guest
Jan 4th, 2017
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html lang="pl">
  3. <head>
  4. <meta charset="utf-8">
  5. </head>
  6. <body>
  7. <p id="demo"></p>
  8.  
  9.  
  10. <script type="text/javascript">
  11.  
  12. function Okienko Prompt1() {
  13. var name = prompt('Podaj imię , nazwisko, e-mail ', 'Kamil Kurłowicz , ytnik10@gmail.com');
  14.  
  15. if (name != null) {
  16. document.write('Nazywasz się : '+ name);
  17. }
  18.  
  19. }
  20.  
  21. function Okienko Prompt2(){
  22. var wiek = parseInt(prompt('Podaj wiek','18'));
  23. if (name != null) {
  24. document.write('Masz: '+ wiek+' lat');
  25. }
  26. }
  27.  
  28. function Okienko Prompt3(){
  29. var wzrost = parseFloat(prompt('Podaj wzrost w metrach','1.73'));
  30. if (name != null) {
  31. document.write('Masz: '+ wzrost+' metrów');
  32. }
  33. }
  34.  
  35. document.getElementById("demo").innerHTML = 'Nazywasz się ' + name;
  36. document.getElementById("demo").innerHTML = 'Podaj wiek' + wiek;
  37. document.getElementById("demo").innerHTML = 'Masz: ' + wzrost+' metrów';
  38.  
  39. document.getElementById('prompt1').addEventListener('click', function() {
  40. Okienko Prompt1()
  41. document.getElementById('prompt2').addEventListener('click', function() {
  42. Okienko Prompt2()
  43. document.getElementById('prompt3').addEventListener('click', function() {
  44. Okienko Prompt3()
  45. });
  46.  
  47. </script>
  48. <input type="button" id="prompt1" value="Okienko Prompt1" />
  49. <input type="button" id="prompt2" value="Okienko Prompt2" />
  50. <input type="button" id="prompt3" value="Okienko Prompt3" />
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement