Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5.  
  6. <title>Question Three</title>
  7.  
  8. <style>
  9.  
  10. </style>
  11.  
  12. <script>
  13.  
  14. function displayDetails() {
  15.     var form = document.getElementById("myForm");
  16.     var name = document.getElementById("first").value;
  17.     var last = document.getElementById("last").value;
  18.     var birth = document.getElementById("birth").value;
  19.     var eye = document.getElementById("eye").value;
  20.     document.getElementById("test").innerHTML = ("Your details: " + name + ", " + last + ", " + birth + ", " + eye );
  21.     console.log("test");
  22.    
  23.  
  24.  
  25.  
  26.  
  27. }
  28.        
  29.  
  30.  
  31.    
  32.  
  33.    
  34. </script>
  35.  
  36. </head>
  37.  
  38. <body>
  39.  
  40. <form id = "myForm">
  41.  
  42. <span> First Name: </span> <input id = "first" type = "text"/> <br/> <br/>
  43. <span> Last Name: </span> <input id = "last" type = "text"/> <br/> <br/>
  44. <span> Date of Birth: </span> <input id = "birth" type = "text"/> <br/> <br/>
  45. <span> Eye Colour: </span> <select id = "eye" name = "eye Colour: ">
  46.     <option> </option>
  47.     <option> Blue </option>
  48.     <option> Green </option>
  49.     <option> Grey </option>
  50.     <option> Brown </option>
  51.     <option> Other </option>
  52. </select>
  53. <br/> <br/>
  54. <button onclick = "displayDetails()"> Display </button>
  55.  
  56.  <br/> <br/>
  57.  
  58.    
  59. </form>
  60.    
  61.    
  62.    
  63. <div id = "test">
  64.    
  65.  
  66. </div>
  67.  
  68. </body>
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement