Guest User

Untitled

a guest
Nov 19th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <body>
  2.  
  3. <div id="mydiv">
  4.  
  5. <p>Hi There</p>
  6.  
  7. <p>How are you?</p>
  8.  
  9. <p>
  10.  
  11.  
  12. <input type="text" id="myresponse">
  13.  
  14.  
  15. <br><input type="button" id="showresponse" value="Show Response">
  16.  
  17. </p>
  18.  
  19. <hr>
  20.  
  21.  
  22.  
  23. </div>
  24.  
  25.  
  26. </body>
  27.  
  28. var $ = function (id) {
  29. return document.getElementById(id)
  30. }
  31.  
  32. var feelings = function ()
  33.  
  34. {
  35.  
  36.  
  37. $("myresponse").focus();
  38.  
  39. var mypara = document.createElement("p");
  40. var myparent = $("mydiv");
  41.  
  42. myparent.appendChild(mypara);
  43.  
  44. var myText = document.createTextNode();
  45.  
  46.  
  47.  
  48. mypara.setAttribute("id", "displayedresponse");
  49.  
  50.  
  51. mypara.appendChild(myText);
  52.  
  53. $("displayedresponse").appendChild(myText);
  54.  
  55.  
  56.  
  57.  
  58.  
  59. }
  60.  
  61.  
  62.  
  63. window.onload = function ()
  64. {
  65.  
  66. $("showresponse").onclick = feelings;
  67. }
Add Comment
Please, Sign In to add comment