Loading ...
Sorry, an error occurred while loading the content.

Re: [svg-developers] changing a fill attribute

Expand Messages
  • G. Wade Johnson
    An approach I ve used in the past is to stash the old value in a new attribute used to store the original color. I put it in a new namespace to save SVG some
    Message 1 of 3 , Apr 12 3:17 PM
    • 0 Attachment
      An approach I've used in the past is to stash the old value in a new
      attribute used to store the original color. I put it in a new
      namespace to save SVG some trouble. Something like

      function highlightme(evt)
      {
      var rect = evt.getTarget();
      var save = rect.getAttributeNS( null, "fill" );
      rect.setAttributeNS( null, "fill", "#FF6EB4" );
      rect.setAttributeNS( "http://example.com/saved", "oldfill", save );
      }


      The second time through you can check to see if the new attribute
      exists, restore the color, and remove the attribute. (Of course, I
      would define the namespace URI to make sense in your project and
      save it in a variable instead of using it inline, but you get the
      idea.)

      G. Wade

      On Mon, 12 Apr 2004 17:00:36 -0000
      "ck_one_2001_uk" <karllewis14@...> wrote:

      > hi all
      > ive a function to change seats colours when they are clicked on. HOW
      > do i make the seats change back to their default colour when clicked
      > on for a second time:
      >
      > see code below:
      > function highlightme(evt) {
      > var rect = evt.getTarget();
      >
      > rect.setAttribute("fill", "#FF6EB4");
      >
      > }
      > <rect id="SectionQ\Row3\Seat2" x="66" y="27" width="2" height="2"
      > karl:price_seat="9" onmouseover="rect_over(evt)" onclick="highlightme
      > (evt);"/>
      >
      > thanks alot folks
      > karl
      >
      >
      >
      > ------------------------ Yahoo! Groups Sponsor
      > ---------------------~--> Buy Ink Cartridges or Refill Kits for your
      > HP, Epson, Canon or Lexmark Printer at MyInks.com. Free s/h on orders
      > $50 or more to the US & Canada.
      > http://www.c1tracking.com/l.asp?cid=5511
      > http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/1U_rlB/TM
      > ---------------------------------------------------------------------
      > ~->
      >
      > -----
      > To unsubscribe send a message to:
      > svg-developers-unsubscribe@yahoogroups.com-or-
      > visit http://groups.yahoo.com/group/svg-developers and click "edit my
      > membership"----
      > Yahoo! Groups Links
      >
      >
      >
      >


      --
      Beware of bugs in the above code; I have only proved it correct, not
      tried
      it. -- Donald Knuth
    Your message has been successfully submitted and would be delivered to recipients shortly.