summaryrefslogtreecommitdiff
path: root/rememberBackground.js
blob: 8edfc88946a6af88bdb8c0bc19b3c37a79e9c764 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function remember(img) {
    localStorage.setItem('background', img);
}
function recall() {
    if (localStorage.getItem("background")) {
        console.log(localStorage.getItem("background"));
        document.body.style.backgroundImage = "url('" + localStorage.getItem("background") + "')";
    }
}
function setup() {
    for (let image of document.getElementsByTagName("img")) {
        image.onclick = function() {sillyBackground(image.src)};
    }
}
window.onload = () => {
    recall();
    setup();
}