I'm looking for some guidance on JavaScript and CSS.
Is there a way to create a popup box where users can input a color (any main primary color recognized by CSS) and then have the background color of the page change accordingly in an external stylesheet? I know it involves a combination of attributes in CSS, but clear guidance on how to apply this in relation to the external CSS file is what I need help with.
Inspired by W3Schools:
function myFunction() {
var person = prompt("Please enter your name", "Harry Potter");
if (person != null) {
document.getElementById("demo").innerHTML =
"Hello " + person + "! How are you today?";
}
}
And also from W3Schools:
onclick="this.parentElement.style.display='none';"
My question now is how do I modify the 'display='none';' part in order to take input from the popup box and use it in the onclick event to achieve my desired effect? Would something like 'this.parentElement.style.backgroundcolor='" + usercolorinput + "';' work?
Your assistance is greatly appreciated.