473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

GIF image not clickable, but perimiter is.

2
I am fairly new to AJAX, JavaScript, and HTML. The below code is just a snippet of my working code, but it does not work the way I expected or want it to work. It also talks
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
  1. <div id="status"> 
  2. <a id="led52" onclick="newAJAXCommand('leds.cgi?led=52');"><DIV id="MSP_MAP_SEL"></DIV></a> 
  3. </div> 
  4.  
  5. <script type="text/javascript"> <!--
  6.  
  7. function updateStatus(xmlData) {
  8.     var ATSE_PTS = '<IMG SRC="http://bytes.com/ATSE-PTS_3.gif" ALT="ATSE-PTS" WIDTH=225 HEIGHT=150>';
  9.     var MSP_GE = '<IMG SRC="http://bytes.com/MSP-GE_3.gif" ALT="MSP-GE" WIDTH=225 HEIGHT=150>';
  10.     var MAP_GE = '<IMG SRC="http://bytes.com/MAP-GE_3.gif" ALT="MAP-GE" WIDTH=225 HEIGHT=150>';
  11.  
  12.     for(i = 0; i < 74; i++)
  13.  
  14.         if (getXMLValue(xmlData, 'led' + i) == 0) 
  15.         {
  16.             if(i == 52)
  17.             {
  18.              document.getElementById('MSP_MAP_SEL').innerHTML = ATSE_PTS;
  19.             }
  20.         }
  21.         else if (getXMLValue(xmlData, 'led' + i) == 1) 
  22.         {
  23.             if(i == 52)
  24.             {
  25.              document.getElementById('MSP_MAP_SEL').innerHTML = MSP_GE;
  26.             }
  27.         }
  28.         else if (getXMLValue(xmlData, 'led' + i) == 2)
  29.         {
  30.             if(i == 52)
  31.             {
  32.              document.getElementById('MSP_MAP_SEL').innerHTML = MAP_GE;
  33.             }
  34.         }
  35. }
  36. setTimeout("newAJAXCommand('status.xml', updateStatus, true)",500);
  37.  
  38.  
  39. //--> </script>
Apr 28 '14 #1
1 1355
billt
2
Thank you Rabbit. I was unaware of that.
Apr 28 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Aaron | last post by:
I know this is a thing used primarily on websites..but since python can do anything ;) I'm trying to make a clickable image map for my wxPython program. Basically, I know how to organize the...
14
by: Jeff Gillingham | last post by:
I'm using a stylesheet to place a small 'background image' in the upper left corner of several pages. Is there a simple way of making that image a clickable link? Thanks.
53
by: Kerberos | last post by:
I followed Dan Cederholm's image replacement tutorial, to replace a header tag by a logo. The h1 is clickable if no CSS is applied but it I replace it by the logo, the area isn't clickable anymore...
5
by: Mel | last post by:
i would like to place a tiny image on the top-left corner of all screens and on clicking the image to to http://www.somewhere.com url can you please help ?
3
by: inonzuk | last post by:
Hi everyone, I'm new to javascript and have the following problem: I have two image buttons: 1) <td><a href="http://localhost/gamerules.php" target="mainwindow"><img onMouseOver="return...
5
by: Camet | last post by:
I have been trying to create a dynamic id for a number of images in a table so that I can identify which image was clicked on later. ie I need to set a variable to the id of each image, that is...
4
by: ShieldsJared | last post by:
Im looking for help making a good GUI out of pure images. I would like to embed the common controls and such, but I want to make a nice looking GUI, similar to that of, say Windows Media Player. ...
2
by: laredotornado | last post by:
Hi, Let's say I have a background image for a table cell. It doesn't repeat and is right-aligned. ..cellBG { background: url('../images/mygf.gif') no-repeat; background-position: right; }
1
by: drn | last post by:
Hello, I have the following code for an image with a footer. <a href="empty.html" target="_blank"><DIV style="width: 100px;"> <img style="WIDTH: 100px; HEIGHT: 50px" alt="alt text" ...
3
by: crazychrisy54 | last post by:
Hi there I just wondered if there is any way using GD to insert a clickable button or some clickable text into a image? It is possible to create images for buttons but what if you want a...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.