So I created a an iphone out of pure css and I am trying to make the screen change on click to make it interactive. I am new to java script, just started learning about it a week or so ago, and browser is telling me "Uncaught ReferenceError: url is not defined" not sure what i'm doing wrong. Any advice on why it is telling me this, so I make sure not to make the same mistake in the future. I am sure it is a simple fix just not sure how to go about it.
<div id="iphone-border">
<div id="off-button"></div>
<div id="mute-button"></div>
<div id="volume-up-button"></div>
<div id="volume-down-button"></div>
<div id="side-lines-1"></div>
<div id="side-lines-2"></div>
<div id="iphone-color">
<div id="camara"></div>
<div id="sensor"></div>
<div id="speaker"></div>
<div id="iphone-screen" onClick="this.style.backgroundImage=url(img/phone-screen.jpg);" >
</div>
<div id="home-button-border">
<div id="home-button-color"></div>
</div>
</div>
</div>
You're missing the quotes:
this.style.backgroundImage = 'url(img/phone-screen.jpg)';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With