Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <div id="mydiv">
- <p>Hi There</p>
- <p>How are you?</p>
- <p>
- <input type="text" id="myresponse">
- <br><input type="button" id="showresponse" value="Show Response">
- </p>
- <hr>
- </div>
- </body>
- var $ = function (id) {
- return document.getElementById(id)
- }
- var feelings = function ()
- {
- $("myresponse").focus();
- var mypara = document.createElement("p");
- var myparent = $("mydiv");
- myparent.appendChild(mypara);
- var myText = document.createTextNode();
- mypara.setAttribute("id", "displayedresponse");
- mypara.appendChild(myText);
- $("displayedresponse").appendChild(myText);
- }
- window.onload = function ()
- {
- $("showresponse").onclick = feelings;
- }
Add Comment
Please, Sign In to add comment