java - How to programmatically change the css background image? -


i have gwt.label background gif.

depending in states want change color , image of label. color change works, don't know how change background image (while still preserving gradient):

my.css:

/* creates linear background gradient */ background: #000000; background: url(myicon.gif) no-repeat 15px, -webkit-linear-gradient(top, hsla(0,0%,100%,.5), hsla(0,0%,100%,0)); background: url(myicon.gif) no-repeat 15px, -moz-linear-gradient background: url(myicon.gif) no-repeat 15px, -ms-linear-gradient //etc 

changing color works:

getelement().getstyle().setproperty("backgroundcolor", "green"); //how change background image?? 

how can alter image property?

if facing situation,instead of changing properties of css i'l change css class

state1

lable.addclassname("state1");// in css image1 

state2

lable.addclassname("state2");//in css image2 

Comments