Hi, I think this is a bit different than what you have in mind but give a look at http://srufaculty.sru.edu/david.dailey/svg/makeDragDrop.svg The code is rather simple, I think, though I'm always delighted by suggestions on how to simplify things. It seems in your second post on this that you may be interested in implementing something like a getElementsByClassName. My recollection is that some W3C group (maybe the DOM group, maybe the CSS group, maybe another??) is adding that to a spec of some sort and that some browsers may have already come up with a hook to allow such. I'm sure some JavaScript libraries (like maybe dojo) provide that for us. regards, David
________________________________ From: [email protected] on behalf of russellgum Sent: Sat 8/30/2008 5:03 PM To: [email protected] Subject: [svg-developers] javascript mouse events and style.setproperty 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 [Non-text portions of this message have been removed] ------------------------------------ ----- 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/

