Advertisement
Guest User

Untitled

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