Скрипт 2 кода
forming.html
function getData() {
//getting the values
var email = document.getElementById("email").value;
var password= document.getElementById("password").value;
var telephone= document.getElementById("telephone").value;
var mobile= document.getElementById("mobile").value;
//saving the values in local storage
var users = JSON.parse(localStorage.getItem('users')) || [];
users.push({ email, password, telephone, mobile });
localStorage.setItem("users", JSON.stringify(users));
}
myforming.html
window.onload = function() {
var users = JSON.parse(localStorage.getItem('users')) || [];
var dataField = document.getElementById('data-field');
users.forEach(function(user) {
var paragraph = document.createElement('p');
paragraph.innerHTML = 'Email: ' +
user.email + ', password: ' + user.password+ ', telephone: ' + user.telephone + ', mobile: '+user.mobile;
dataField.appendChild(paragraph);
});
}
Первый код:
forming.html
myforming.html