Skip to content
Permalink
33b01adf9e
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
57 lines (37 sloc) 1.25 KB
var colorWell;
var defaultColor = "#0000ff";
window.addEventListener("load", startup, false);
function startup() {
colorWell = document.querySelector("#colorWell");
colorWell.value = defaultColor;
colorWell.addEventListener("input", updateFirst, false);
colorWell.addEventListener("change", updateAll, false);
colorWell.select();
}
function updateFirst(event) {
var bg = document.querySelector("bg");
if (bg) {
bg.style.color = event.target.value;
}
}
function updateAll(event) {
document.querySelectorAll("body").forEach(function(bg) {
bg.style.color = event.target.value;
});
}
const button = document.querySelector("button");
const bg = document.querySelector("body");
const title = document.querySelector("h1")
button.addEventListener("click", () => {
bg.style.backgroundColor = "#49c9fa";
title.style.fontFamily = "Impact,Charcoal,sans-serif";
});
const button2 = document.getElementById("theme2");
button2.addEventListener("click", () => {
bg.style.backgroundColor = "#dd5040";
title.style.fontFamily = "Helvetica";
});
for (let i = 0; i < localStorage.length; i++) {
let storedValue = localStorage.key(i);
console.log(`Item at ${i}: ${storedValue}`);
}