Advertisement
Guest User

bee-disappear

a guest
Jun 18th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // 1. Get the <form> element
  2. form = document.querySelector('#create-form');
  3. console.log(form)
  4.  
  5. // 2. Event Listen when form has been submitted
  6. // // 2.1 Prevent the default behavior of form submission
  7. form.onsubmit=function(event){
  8.     event.preventDefault();
  9.     // this is prevent any button within the form refresh when being clicked.
  10. //  // write your code her
  11.     console.log("clicked button!");
  12.  
  13. // it only apply to button in the form
  14. // // 2.2 Get the value of <input> elements
  15. msg= document.querySelector('#input-msg').value;
  16. img=document.querySelector('#input-img').value;
  17. // console.log(inputMsg.value) this is to show out the value
  18. // msg is the name put on the id input-msg
  19. // img is the name put on the id input-img.these two is named for the future purpose
  20.  
  21. console.log(msg);
  22. // msgVal=msg.value;
  23. // this is to put value on the function
  24.  
  25. // // 2.3 Concatenate the URL string
  26. homeurl="file:///C:/Users/User/Desktop/disappearing-message-app-boiler-master/message.html"
  27. url=homeurl + "?img-url=" + img + "&msg=" + msg
  28. // homeurl is the url that u would like to link on when result is generated. in this case will be the message.html.
  29. // the "?img-url"  and "&msg" is same and act like the conjunction used to connect homeurl and img.
  30. // // 2.4 Get the <p> element and change it's value to the URL string
  31.  
  32. paragraph= document.querySelector('#share-url');
  33. paragraph.innerHTML=url;
  34. console.log(paragraph);
  35. // the purpose of console log is to test whether the command works
  36. // name the id share-url into paragraph. run the result of html generated in url form
  37. }
  38.  
  39. // window.setTimeout("closetext()",3000);
  40.  
  41. // function closetext(){
  42. //  document.querySelector("h1").style.display="none";
  43.  
  44. // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement