Avoid sending GIF files, while dynamically generating HTML pages

V

vanisathish

Hi All,

I need to constantly update some values to the User Interface. In order
to do the updation efficiently, i am planning to run some script in the
server side that constantly keeps sending the values alone to the User
Interface client. 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 ?

Thanks
Vanitha
 
P

Peroli

Hi Vanitha,
What ever you are trying to say is not very clear. If you post some
code along with your question it will be helpful for us to help you.

-- Peroli Sivaprakasam
 
R

RobG

Hi All,

I need to constantly update some values to the User Interface. In order
to do the updation efficiently, i am planning to run some script in the
server side that constantly keeps sending the values alone to the User
Interface client. 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 ?

You could load the two images, say have the redArrow visible by
default and the green not visible. Then toggle their style.display
values, something like:

...
var isUp = testEquipment();
greenArrow.style.display = ( isUp )? '' : 'none';
redArrow.style.display = ( isUp )? 'none' : '';
...
 
M

Martin Honnen

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top