The logic is to check the url of the CSS element's id(.boot). If the url matches, which it does, then it prints hello world. But it doesn't do anything and I don't know why.
Context: There's a button. I click it. It checks the CSS background url. If the url matches it creates an alert.
CSS:
.boot {
width: 1000px;
height: 1000px;
background-image:url(Videos/printgifstart.GIF);
background-repeat: no-repeat;
background-size: 100%;
background-position: center;
position: fixed;
bottom: -150px;
right: 105px;
z-index: 100;
}
HTML + Javascript
<div class="Logo2" id="blogo">
<h1></h1>
<div class="MirroredSmiles"></div>
<button id="ticketb" class="ticketb"
style="height:100px;
width: 75px;
position: fixed;
top: 335px;
left: 200px;
opacity: 0%;"
onclick="tixbPLS">
</button>
<script>
var tix = document.getElementsByClassName('ticket');
var tixb = document.getElementById('ticketb');
var tixc = document.getElementById('ticketc');
var sart = document.getElementById('shopdrawing');
var sart2 = document.getElementById('shopdrawing2');
var sart3 = document.getElementById('shopdrawing3');
var sbakdo = document.getElementById('backdoor2');
tixb.addEventListener('click', tixbPLS);
function tixbPLS() {
if (document.getElementById('boot').style.backgroundImage = url('Videos/printgifstart.GIF'))
{
alert("hello! world!");
}
}
</script>
</div>
I looked online and the issue seemed to lean into a syntax error but I have played with the syntax for hours and it cannot print hello world.
I thought maybe this only works with images and even with an image still no luck.
I tried "=" or "==" still no luck.
I thought maybe somehwere in the code something else is the issue. So instead of the original if statement. I did a math equation type if statement and the alert worked perfectly.
So everything else is fine except for that singular if line.