
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, Darren,
Thank you for your replies.
I've implemented the fixes you suggested, but it's still not hitting.
What I've got now:
(function buttonClicked(threestate) {
var images = new Array( "radar_max_green.png",
"radar_min_yellow.png",
"radar_off_red.png");
var newimage = images.shift();
images.push(newimage);
var ctrl = document.getElementById("radar");
ctrl.styles.backgroundImage = newimage;
})();
<input type="button"
id="radar"
onclick="buttonClicked('radar')"
style="background-image:
url(images/green.png);width:53px;height:53px;border:0;"
value="" />
Firebug tells me:
ctrl is null
buttonClicked(Object { name="threestate"})button_3_stage.js (line 13)
button_3_stage.js()button_3_stage.js (line 9)
[Break on this error] ctrl.styles.backgroundImage = newimage;
button_3_stage.js (line 13)
buttonClicked is not defined
function onclick(event) { buttonClicked("radar"); }(Object {
name="event"})2 (line 2)
[Break on this error] buttonClicked("radar");
I don't know why ctrl is null - is it not succeeding in identifying the
right div?
And how can buttonClicked not be defined? Looks like it is at least
being defined, even if it's not doing anything.
--
Dave M G
Home |
Main Index |
Thread Index