Stelian
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Stelian
-
-
Hello, I am trying to make website with inclusive design for my homework and I have three functions that are changing the text size, text style and site color theme, but I can not save the changes after I reload the page. This is my code for changing the text size:
localStorage.setItem('z', '1');function size() {if (localStorage.getItem('z')=="1"){txt = document.getElementById("a").style.fontSize = "25px";localStorage.removeItem("z");localStorage.setItem('z', '2');}else if (localStorage.getItem('z')=="2") {txt = document.getElementById("a").style.fontSize = "30px";localStorage.removeItem("z");localStorage.setItem('z', '3');}else {txt = document.getElementById("a").style.fontSize = "20px";localStorage.removeItem("z");localStorage.setItem('z', '1');}}The code in my html is this:<body onload="size()"><button type="button" " onclick="size();">Change Text Size</button><div id='a'>Some text</div></body>I believe I can make the other two function save their changes If I see how to make this one.Thank you ! -
Hello,
I made some buttons with functions to change text size and style also another button to change site theme, but I can not make them save after I go to the next page or after I reload the page. I want to use local storage but I don't know if it is possible. Here is my project:
https://github.com/Stelian1996/projects-folder
How to save this in local storage ?
in JavaScript
Posted
I accidentally made another topic of this problem and In it I show my code with local storage. It works but it does not save after reload. Link to the other topic