Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught ReferenceError: url is not defined

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>
like image 577
Carlos Guevara Avatar asked Dec 08 '22 04:12

Carlos Guevara


1 Answers

You're missing the quotes:

this.style.backgroundImage = 'url(img/phone-screen.jpg)';
like image 191
JLRishe Avatar answered Dec 11 '22 11:12

JLRishe