Okay so, I have my story all done and I have a couple of my passages tagged with "bg." I want to use JavaScript to change the background image for a couple of passages.
I'm using Harlowe.
Admittedly, JavaScript isn't my strong point, but I've figured it out for the most part (I think).
So, how do I tell the javascript to change the background based on the tag? It says I need to define "bg" when I try to run it, so do I need to use
$bg
before the main script?
I hope this made sense. JavaScript is below:
if (tags = bg) {
document.body.style.backgroundImage = "bg1.png";
} else {
document.body.style.backgroundImage = "bg2.png";
}
Thanks in advance!
Comments
I've defined both "bg" and "tags" now. With var instead of $. Mixed up my languages there.
I still can't get this to work.
Sorry for the bump.