va*********@gmail.com wrote:
But i need to send some GIF files as well to change
the colour of the block diagram. something like send a green arrow when
the equipment is UP and red arrow gif file when its down.
How can i avoid sending the GIF files, continuously to client ? Is it
possible for me to have one single GIF file, so that i can modify the
colour of the gif file with some option ?
I don't think browsers allow you to download a GIF image and then
manipulate parts of it. As you are talking about arrows however you
could check whether an Unicode character displaying an arrow comes close
to what you want to render with the GIF and then not use the GIF but the
character. If the character is then inside a e.g. a span element the
color change is simply done with CSS manipulation e.g.
var span = document.createElement('span');
span.appendChild(document.createTextNode('\u2192') );
span.onclick = function (evt) {
if (this.style) {
if (this.style.color == '' || this.style.color == 'red') {
this.style.color = 'green';
}
else {
this.style.color = 'red';
}
}
};
document.body.appendChild(span);
Character looks like this '→'. You can style it with CSS of course for
font size, color etc.
Unicode arrow characters are liste here (PDF!):
<http://www.unicode.org/charts/PDF/U2190.pdf>
With very few browser around (Opera 8, Firefox 1.5 beta) you can also
embed SVG graphics in a document and at least Firefox then allows script
to manipulate the SVG graphics.
--
Martin Honnen
http://JavaScript.FAQTs.com/