Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form id="signupForm">
- <label for="username">Username:</label><br>
- <input type="text" id="username" name="username"><br>
- <label for="password">Password:</label><br>
- <input type="password" id="password" name="password"><br>
- <input type="submit" value="Submit">
- </form>
- <script>
- document.getElementById('signupForm').addEventListener('submit', function(event) {
- event.preventDefault();
- var username = document.getElementById('username').value;
- var password = document.getElementById('password').value;
- // Here you would usually send the user data to your server
- // console.log('User signed up with username: ' + username + ' and password: ' + password);
- // Set a cookie to store the username
- document.cookie = "username=" + username + "; expires=Thu, 18 Dec 2023 12:00:00 UTC; path=/";
- // Now you can access the cookie like this
- var allCookies = document.cookie;
- console.log("All cookies: " + allCookies);
- // If you want to delete the cookie, you can uncomment the following line
- //document.cookie = "username=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
- });
- </script>
Advertisement
Comments
-
- Link how to add ads: https://pastebin.com/7chNdrZw
Add Comment
Please, Sign In to add comment
Advertisement