thanks some times you get the problems from the basics, i should have checked the attributes first ,
any way it worked and many thanks --- In [email protected], Holger Will <[EMAIL PROTECTED]> wrote: > > Hi alsaeedabraheem > > > <?xml version="1.0" standalone="no"?> > > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" > > "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> > > <svg id="SVG" width="" height="" onload="Initialize(evt)"> > > specify a value for "width" and "height", or drop them completely (then > "width" and "height" default to 100%). > dont forget to declare the svg namespace. so this line may look like this: > > <svg id="SVG" onload="Initialize(evt)" xmlns="http://www.w3.org/2000/svg"> > > > > > > > > > > > > > <script type="text/javascript"> > > <![CDATA[ > > var SVGRoot; > > var SVGDoc; > > var cyy; > > var cxx; > > var change; > > var height; > > > > > > > > function Initialize(evt){ > > SVGDoc = evt.getTarget().getOwnerDocument(); > > SVGRoot = SVGDoc.getElementById("to-be-updated"); > > height= SVGRoot.getAttribute("height"); > > "SVGRoot" is a circle, circles dont have a "height" attribute(maybe also > change the name of this variable to avoid confusion) > so: > SVGRoot = SVGDoc.getElementById("to-be-updated"); > height= SVGRoot.getAttribute("r")*2; > > > > > } > > > > function Up(value){ > > cyy = SVGRoot.getAttribute('y'); > > circles dont have an "y" attribute, its: > cyy = SVGRoot.getAttribute('cy'); > > > change = height*value; > > mmh... do you really mean this? "height" is 2*r=160 value is -10 so > 160*-10=-1600 > > > SVGRoot.setAttribute('y', cyy - change); > > again not "y" but "cy": > SVGRoot.setAttribute('cy', cyy - change); > "cyy" is 400 > "change" is -1600 > your new cy will be set to 400-(-1600)=2000 > > > } > > > > ]]> > > </script> > > <text x="455" y="55" style="font-size:l6px; font-weight:bold; " > > onclick="Up(-10)">click to move the circle up</text> > > <circle id="to-be-updated" cx="200" cy="400" r="80" style="font- > > size:l4px ;stroke:black" /> > > </svg> > > > > > > hth > > Holger ----- 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/ <*> 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/

