Currently, I am facing an issue with changing the background image on my webpage. The problem is that when I change the background image on one page, it also reflects on another page where I don't want the change to occur. Is assigning an id/class to the body element on the first page a viable solution to this problem (where I want the hover function)?
<!DOCTYPE Html>
<head>
<meta charset="utf-8" />
<title>MakeHappy, One good thought everyday!</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="randomMessages.js"></script>
<link rel="stylesheet" href="MakeHappy.css" />
</head>
<div id="wink" class="imageSwap">
</div>
<body>
<header>
<nav>
<ul>
<a id="MakeHappy" href="Main.html">Make Happy</a>
<a id="Contact" href="#">Contact us</a>
<a id="Suscribe" href="#">Suscribe</a>
<a id="Project" href="#">Project</a>
</ul>
</nav>
</header>
</body>
\
<!DOCTYPE Html>
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="randomMessages.js"></script>
<title>MakeHappy, One good thought everyday!</title>
<link rel="stylesheet" href="MakeHappy.css" />
</head>
<body class="Main">
<input type="button" onclick="popup()" value="Click to be Happy!">
<div id="demo"></div>
</body>
\
body {
background-image: url("MakeHappy.jpg");
background-repeat: no-repeat;
background-position: 200px 60px;
background-size: 900px;
background-color: black;
}
body:hover{
background-image: url("MakeHappy2.jpg");
background-position: 200px 60px;
}
.Main{
background-size: 100px;
background-position:top;
}
.imageSwap{
position:absolute;
color: yellow;
padding: 150px;
bottom: 130px;
right: 500px
}
#MakeHappy{
color: white;
position: absolute;
right: 660px;
}
#Contact{
color: white;
position: absolute;
right: 660px;
bottom: 10px;
transform: rotate(180deg);
}
#Suscribe{
color: white;
position: absolute;
left: 320px;
bottom: 300px;
transform: rotate(270deg);
}
#Project{
color: white;
position: absolute;
right: 360px;
bottom: 300px;
transform: rotate(90deg);
}
.Main div{
color: white;
position: fixed;
}
input{
position: fixed;
bottom: 150px;
left: 625px;
}