Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] [OT] Looking for Javascript 3-toggle button [SOVLED]



Godwin,

Thank you very much for your continued help and code!

The current code works. At first it didn't, but I set up a console
message and learned that it was indeed switching the name of the image
file, but it wasn't showing up on the actual page. So the code was doing
the cycling as intended, just not giving the results to the HTML page.

Long story short, some more Googling revealed that the way one sets
backgroundImage in Javascript is a little different than what we had
been using up to now.

Instead of this:

ctrl.style.backgroundImage = newimage + ".png";

... the syntax needs to be more explicit about the CSS:

ctrl.style.backgroundImage = "url('" + newimage + ".png')";

Once I got that, your code works like a charm!

Thanks for walking me through this. I also now see clearly the issue
with passing the variable ("threestate"). Once you explained it, I
realized it works the same as PHP and I kicked myself for not realizing
that.

Your help is much appreciated.

-- 
Dave M G


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links