daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Apr 21st, 2018 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <title>form</title>
  5. </head>
  6. <body>
  7.   <button id="clickForm1">Form 1</button> | <button id="clickForm2">Form 2</button>
  8.  
  9.   <hr>
  10.  
  11.   <!-- Form 1 -->
  12.   <form id="form1" style="display: none;">
  13.     <h3>Login - Form 1</h3>
  14.     <div>
  15.       <label>Username:</label>
  16.       <input type="text" name="">
  17.     </div>
  18.     <div>
  19.       <label>Password:</label>
  20.       <input type="password" name="">
  21.     </div>
  22.     <input type="submit" name="" value="Login!">
  23.   </form>
  24.  
  25.   <!-- Form 2 -->
  26.   <form id="form2" style="display: none;">
  27.     <h3>Register - Form 2</h3>
  28.     <div>
  29.       <label>Email:</label>
  30.       <input type="email" name="">
  31.     </div>
  32.     <div>
  33.       <label>Username:</label>
  34.       <input type="text" name="">
  35.     </div>
  36.     <div>
  37.       <label>Password:</label>
  38.       <input type="password" name="">
  39.     </div>
  40.     <input type="submit" name="" value="Register!">
  41.   </form>
  42.  
  43. <script type="text/javascript">
  44. document.getElementById("clickForm1").addEventListener("click", toggleForm1);
  45. document.getElementById("clickForm2").addEventListener("click", toggleForm2);
  46.  
  47. function toggleForm1() {
  48.   var form1 = document.getElementById("form1");
  49.   if (form1.style.display === "none") {
  50.     form1.style.display = "block";
  51.   } else {
  52.     form1.style.display = "none";
  53.   }
  54. }
  55.  
  56. function toggleForm2() {
  57.   var form2 = document.getElementById("form2")
  58.   if (form2.style.display === "none") {
  59.     form2.style.display = "block";
  60.   } else {
  61.     form2.style.display = "none";
  62.   }
  63. }
  64. </script>
  65. </body>
  66. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top