Advertisement
Guest User

Untitled

a guest
Oct 17th, 2016
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. $(document).ready(function (){
  2. // Get the modal
  3. var modal = document.getElementById('myModal');
  4.  
  5. // Get the button that opens the modal
  6. var btn = document.getElementById("Login");
  7.  
  8. // Get the <span> element that closes the modal
  9. var span = document.getElementsByClassName("close")[0];
  10.  
  11.  
  12. var submitter = document.getElementsByClassName("Send");
  13.  
  14. // When the user clicks the button, open the modal
  15. btn.onclick = function() {
  16. modal.style.display = "block";
  17.  
  18. }
  19.  
  20. submitter.onclick = function(){
  21. var x = document.getElementById("loginForm");
  22. var user = document.cmxForm[loginForm][username].value;
  23. var password = document.cmxForm[loginForm][password].value;
  24. // var user=x.elements[0].value();
  25. // var password=x.elements[1].value();
  26. // var user=$("#username").val();
  27. // var password=$("#password").val();
  28. // console.log(user);
  29. //console.log(password);
  30. if (verifyCookie(user, password) == true)
  31. {
  32. text="H";
  33. $('.header').html(/* El html del segundo ejercicio del primer set*/);
  34.  
  35. // document.getElementById("loginForm").innerHTML = text;
  36. }
  37. else
  38. {
  39. text=" No test";
  40. setCookie(user, password);
  41. alert("The cookie was not found previously");
  42. modal.style.display="none";
  43.  
  44. }
  45.  
  46. }
  47.  
  48. // When the user clicks on <span> (x), close the modal
  49. span.onclick = function() {
  50. modal.style.display = "none";
  51. }
  52.  
  53. // When the user clicks anywhere outside of the modal, close it
  54. window.onclick = function(event) {
  55. if (event.target == modal) {
  56. modal.style.display = "none";
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement