+ 1
How to compare an image's url in javascript
I want to switch an image whenever it is clicked currently I am using this code. x stores the class I have assigned with background. if(x.style.backgroundImage=="URL('1.jpg')") x.style.backgroundImage=URL('2.jpg'); else something else
2 odpowiedzi
0
There's a image slider tutorial in last chapter (DOM & Events) of Javascript that is quite useful. It stores image url in an array, creates a function that change the array number while onclick event is triggered. Check it out.
0
thank u nicholas