From a38cc0514f5af1b9fce0fb9c49e5221395ff6171 Mon Sep 17 00:00:00 2001 From: AlmightyMiau Date: Fri, 18 Jul 2025 00:29:06 +0900 Subject: apply onclick function to all images --- rememberBackground.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'rememberBackground.js') 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 -- cgit v1.2.3