Advertisement
angryatti

JavaScript - átlátható

Dec 17th, 2021
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.40 KB | None | 0 0
  1. <html lang="hu">
  2. <head>
  3. <meta charset="utf-8">
  4. <title>Form elemek</title>
  5. <script>
  6.  
  7. function eletkor(){
  8. var age=document.getElementById("age").value
  9.     if (age<30)
  10.     {document.getElementById("kor").innerHTML = age+" évesen még túl fiatal vagy!";}
  11.     else
  12.    
  13.         {document.getElementById("kor").innerHTML = age+" évesen már tapasztalt vagy!";}
  14.  
  15.  
  16. }
  17. function kiir(){
  18.     document.getElementById("nevem").innerHTML = document.getElementById("nev").value+", ";
  19.     eletkor();
  20. }
  21.  
  22. </script>
  23. </head>
  24. <body>
  25. <span id="nevem"></span>
  26. <span id="kor"></span>
  27.  
  28. <form name="kerdoiv" action="index.html" method="post">
  29. <table>
  30. <tbody>
  31. <tr>
  32. <td>
  33. &nbsp
  34.  
  35. </td>
  36. <td>
  37. <label name="nev">Név: </label>
  38.  
  39. </td>
  40. <td>
  41. <input type="text" name="nev" id="nev"> </label>
  42.  
  43. </td>
  44. <td>
  45. &nbsp
  46.  
  47. </td>
  48. </tr>
  49. <tr>
  50. <td>
  51. &nbsp
  52.  
  53. </td>
  54. <td>
  55. <label name="nev">Életkor: </label>
  56.  
  57. </td>
  58. <td>
  59. <select name="age" id="age">
  60. <option value="18">18</option>
  61. <option value="23">23</option>
  62. <option value="28">28</option>
  63. <option value="33">33</option>
  64. <option value="38">38</option>
  65. <option value="43">43</option>
  66. </select>
  67. </td>
  68. <td>
  69. &nbsp
  70.  
  71. </td>
  72. </tr>
  73. <tr>
  74. <td>
  75. &nbsp
  76.  
  77. </td>
  78. <td>
  79. <input type="button" name="kuld" value="Küld" onclick="kiir();">
  80.  
  81. </td>
  82. <td>
  83. <input type="reset" name="torol" value="Töröl">
  84.  
  85. </td>
  86. <td>
  87. &nbsp
  88.  
  89. </td>
  90. </tr>
  91. </tbody>
  92.  
  93. </table>
  94.  
  95.  
  96. </form>
  97.  
  98.  
  99. </body>
  100.  
  101.  
  102. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement