By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,948 Members | 1,559 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,948 IT Pros & Developers. It's quick & easy.

Avoid sending GIF files, while dynamically generating HTML pages

P: n/a
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

Sep 14 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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.
how do you intend to get this to work ? how will your server update the
clients UI ?
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 ?


just preload all the gifs that you will need and then swap them when the
conditions are met.
Sep 14 '05 #2

P: n/a
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

va*********@gmail.com wrote:
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


Sep 14 '05 #3

P: n/a
va*********@gmail.com wrote:
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' : '';
...


--
Rob
Sep 14 '05 #4

P: n/a


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/
Sep 14 '05 #5

P: n/a
va*********@gmail.com wrote:
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 ?


Sounds like a job for XMLHTTP or a hidden <iframe>
Every X period of time, you have the browser make a new request
to the server, where a cgi or such could return a small
dynamicly generated XML file containing the status of
any number of items.

If you use a .cgi to report the equipment status, add something
like a randome filename made of the current date and time , with a file
extension of the data format being returned "TodaysDateAndTime.xml" One
could return the data as javascript too "TodaysDateAndTime.js".

http://www.yoursever.com/YourEquipmentStatus.cgi/
http://www.yoursever.com/YourEquipme...ateAndTime.xml

Either way , you can now take this returned data and use it to update
your client-side display without having to visibly load anything,
and without having to load any images at all.
--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML, CSS,Javascript
--=<> http://resume.drclue.net <>=-- AJAX, SOAP, XML, HTTP
--=<> http://www.drclue.net <>=-- SERVLETS,TCP/IP, SQL
--.
Sep 14 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.