I have a webpage I am designing with html, css, and JS. I have them properly hooked up, but for some reason my header will not do what I want. I have tried everything, does anyone know where I went wrong?
I want it so that when I mouse over the header or click the header, the color will change. This does not happen.
The important code in a JS-Fiddle: https://jsfiddle.net/DITTO/c37zxdke/
//javascript
var col = document.getElementById("webTitle").style.color;
function orangeToBlue() {
col = "#197CFF";
}
function blueToGreen() {
col = "#19FF29";
}
function greenToPink() {
col = "#FF19EF";
}
function pinkToOrange() {
col = "#FF9C19";
}
function changeColor() {
if (document.getElementById("webTitle").style.color === "#FF9C19") {
orangeToBlue();
} else if (document.getElementById("webTitle").style.color === "#197CFF") {
blueToGreen();
} else if (document.getElementById("webTitle").style.color === "#19FF29") {
greenToPink();
} else if(document.getElementById("webTitle").style.color === "#FF19EF") {
pinkToOrange();
}
}
//html
<h1 id="webTitle" onmouseover="changeColor()">Webpage Title</h1>
//css
#webTitle:hover {
cursor: pointer;
}
#webTitle {
text-shadow: 3.5px 3.5px 0px rgba(0, 0, 0, 0.3);
font-size: 100px;
font-family: fantasy;
color: #FF9C19;
}