Skrevet av Emne: SVG+Javascript: Get or set element properties  (Lest 5293 ganger)

ATC

  • Gjest
SVG+Javascript: Get or set element properties
« på: 18. Juli 2010, 17:55 pm »
  • [applaud]0
  • [smite]0
  • How do I access the current SVG element properties, and how do I change them?




    ATC

    • Gjest
    [Solved] SVG+Javascript: Get or set element properties
    « Svar #1 på: 18. Juli 2010, 17:55 pm »
  • [applaud]0
  • [smite]0
  • Access the current value of a circle element (assuming 'object' references the circle):
    posx = object.cx.baseVal.value;

    Change the value of a that same element:
    object.style.setProperty('cx', posx, '');