Avoid sending GIF files, while dynamically generating HTML pages

Discussion in 'Javascript' started by vanisathish@gmail.com, Sep 14, 2005.

  1. Guest

    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, 2005
    #1
    1. Advertising

  2. Peroli Guest

    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

    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
    Peroli, Sep 14, 2005
    #2
    1. Advertising

  3. RobG Guest

    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
    RobG, Sep 14, 2005
    #3
  4. 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/
    Martin Honnen, Sep 14, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. www.MSmobiles.com
    Replies:
    1
    Views:
    1,500
    www.MSmobiles.com
    Jul 18, 2004
  2. hb
    Replies:
    6
    Views:
    9,106
  3. Beauregard T. Shagnasty

    Re: filename.gif or filename.gif.jpg?

    Beauregard T. Shagnasty, May 30, 2008, in forum: HTML
    Replies:
    1
    Views:
    733
    Jonathan N. Little
    May 30, 2008
  4. Bergamot
    Replies:
    0
    Views:
    434
    Bergamot
    May 30, 2008
  5. Faisal Vali
    Replies:
    10
    Views:
    220
    Thomas 'PointedEars' Lahn
    Jun 21, 2008
Loading...

Share This Page