Mailing List Archive


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

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



Godwin,

Thank you for responding.

I'm fully aware of the difference between Java and Javascript. Netbeans
comes with plugins to handle PHP, Javascript, CSS, HTML, and other
things I find useful. For a free IDE, it's the most fully featured and
easy to use that I have tried so far.

Anyway, I took out more of the parenthesis and a semi colon. I was still
getting Firebug errors, though. I looked them up on Google, and I found
that ctrl.styles should be ctrl.style (no "s").

Now there's no more errors. So that's progress.

But, it's simply not doing anything. When I click the button, it does
not change the background image. It sticks with the original "green.png"
image, and does not switch to the red or yellow.

What I've got now is:

function buttonClicked(threestate) {
   var images = new Array( "green.png",
                        "yellow.png",
                        "red.png");
    var newimage = images.shift();
    images.push(newimage);
    var ctrl = document.getElementById("radar");
    ctrl.style.backgroundImage = newimage;
}
<input type="button"
                 id="radar"
                 onclick="buttonClicked('radar')"
                 style="background-image:
url(green.png);width:53px;height:53px;border:0;"
                 value="" />

Any idea what's missing?

-- 
Dave M G


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links