with a server (microchip Ethernet controller microcontroller chip) running "C" code.
I have three gif images and depending upon the result I get from getXMLValue, if it's equal to 0, 1, or 2, I want one of my three different gif images to display. So I figured that the best way to do that was by using the innerHTML property of document.getElementByID to replace the HTML code with one of the three gif images based upon the condition.
I am using the onclick and AJAX code because I'm modifying example code that I started from and this is what they used. Like I'd mentioned above, while this does work, it isn't working the way I want it to work. I want to be able to click either of the three gif images and have that click be recognized by the underlying "C" code to do a particular function. But it only works if I click on a far perimiter (left or right hand side) of the image, but not if I click in the center or anywhere else on the gif image itself. What am I doing wrong here?
Thanks.
Bill
Expand|Select|Wrap|Line Numbers
- <div id="status">
- <a id="led52" onclick="newAJAXCommand('leds.cgi?led=52');"><DIV id="MSP_MAP_SEL"></DIV></a>
- </div>
- <script type="text/javascript"> <!--
- function updateStatus(xmlData) {
- var ATSE_PTS = '<IMG SRC="http://bytes.com/ATSE-PTS_3.gif" ALT="ATSE-PTS" WIDTH=225 HEIGHT=150>';
- var MSP_GE = '<IMG SRC="http://bytes.com/MSP-GE_3.gif" ALT="MSP-GE" WIDTH=225 HEIGHT=150>';
- var MAP_GE = '<IMG SRC="http://bytes.com/MAP-GE_3.gif" ALT="MAP-GE" WIDTH=225 HEIGHT=150>';
- for(i = 0; i < 74; i++)
- if (getXMLValue(xmlData, 'led' + i) == 0)
- {
- if(i == 52)
- {
- document.getElementById('MSP_MAP_SEL').innerHTML = ATSE_PTS;
- }
- }
- else if (getXMLValue(xmlData, 'led' + i) == 1)
- {
- if(i == 52)
- {
- document.getElementById('MSP_MAP_SEL').innerHTML = MSP_GE;
- }
- }
- else if (getXMLValue(xmlData, 'led' + i) == 2)
- {
- if(i == 52)
- {
- document.getElementById('MSP_MAP_SEL').innerHTML = MAP_GE;
- }
- }
- }
- setTimeout("newAJAXCommand('status.xml', updateStatus, true)",500);
- //--> </script>