firefox - SVG 'def' tag not functioning with JS events -
all,
am having bit of issue javascript events associated svg 'defs' tag in firefox 3.6 & firefox 4.0b.
i have image on svg canvas enclosed in 'defs' tags. have event attached cursor cursor gives co-ordinates mouse rolls on image. seems working in chrome, safari & opera not in firefox browsers. in firefox, there no error shown, co-ordinates donot appear cursor movement.
any advice , suggestions?
edit: erik, reply. apologies error, did mean 'defs' tag. here code:
var cur= svgdoc.getelementbyid("backdrop1") cur.setattribute("stroke-width","1" ) zain.setattribute("stroke","black") zain.setattribute("fill","purple") zain.setattribute("stroke","black") zain.setattribute("opacity","0.3") zain.setattribute("pointer-events","all") cur.onmousemove=function(event) { x=event.pagex-320 y=event.pagey-330 if(x>0 && y<0) { document.getelementbyid("x").value=x document.getelementbyid("y").value=y*(-1) }else if(x<0 && y<0) { document.getelementbyid("x").value=x document.getelementbyid("y").value=y*(-1) }else if(x>0 && y>0) { document.getelementbyid("x").value=x document.getelementbyid("y").value=y*(-1) }else if(x<0 && y>0) { document.getelementbyid("x").value=x document.getelementbyid("y").value=y*(-1) }else if(x==0 && y==0) { document.getelementbyid("x").value=x document.getelementbyid("y").value=y*(-1) } }
stackoverflow not letting me past svg code in here reason. ive uploaded text file onto 4shared. hope thats ok.
kayote, consider posting full file rather piece. there context missing. starters, can't see id values "x" , "y" assigned elements. error might there.
i started working svg content within html files past week, , first problem encountered changing file ending .xml rather .html, @ least particular file creating, enabled me svg effects work in html page when these effects wouldn't otherwise work despite being copied working .svg file.
another problem encountered in not using ns version of document.createelementns create "use" node [ie, have specify "http://www.w3.org/2000/svg" parameter call rather use standard .createelement call).
yet problem reason (which don't yet understand), ansvgelement.setattribute("visibility", "hidden") did not work while ansvgelement.setattribute("style", "visibility:hidden") did.
there various things might have gone wrong have nothing bit focused on.
Comments
Post a Comment