I have an svg application where a click on a polygon changes its color and sets 
up an entry 
to a database. This works fine except when I want to change my mind and 
unselect the 
polygon and change its color back to the original.

I tried to use a mouseup to select the polygon that needs to have its color 
reset. This 
sortof works but the click event also triggers the mouseup function so I get 
extraneous 
data in my database. 

I tried up using a mousedown event to select and a mouseup to unselect, but 
this is very 
dependent on the users moving the mouse into or out of the polygon. This does 
work, 
however.

So, question 1 is: Is there a better way to select and then unselect a polygon?

Next

I tried to determine the fill color of a polygon via javascript but had little 
success.

function restoreColor(evt) {
        
        objet=evt.target;
        att=objet.attributes;
        var state = document.getElementById(att.item(0).value);
        var style = state.style;
        
        //var oldcolor = att.item(4).value); (this is the original polygon 
color)
        //alert(oldcolor); (this does not work)

        style.setProperty("fill","blue", "");  (for some reason -- ie my lack 
of expertise in 
javascript -- I could not replace "blue" with att.item(4).value)
        chaine = chaine+'field='+ att.item(0).value +"&";
        alert("chaine" + "   " + chaine);
        }

Question 2 is how can I define a variable that would allow me to replace "blue" 
in the 
example above with the original polygon fill which is att.item(4).value


------------------------------------

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
----Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to