diff options
author | AlmightyMiau <almightymeow612@gmail.com> | 2025-07-18 00:29:06 +0900 |
---|---|---|
committer | AlmightyMiau <almightymeow612@gmail.com> | 2025-07-18 00:29:06 +0900 |
commit | a38cc0514f5af1b9fce0fb9c49e5221395ff6171 (patch) | |
tree | 0996169b4cb06a5aa4181b134013b2787221a935 /rememberBackground.js | |
parent | 67d326889b3f2530722cac11c746606a0d7662e7 (diff) |
apply onclick function to all images
Diffstat (limited to 'rememberBackground.js')
-rw-r--r-- | rememberBackground.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/rememberBackground.js b/rememberBackground.js index 3cdc4de..8edfc88 100644 --- a/rememberBackground.js +++ b/rememberBackground.js @@ -4,9 +4,15 @@ function remember(img) { function recall() { if (localStorage.getItem("background")) { console.log(localStorage.getItem("background")); - document.body.style.backgroundImage = 'url("https://almightymiau.gay/' + 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(); }
\ No newline at end of file |