In order to change SVG-elements per javascript one needs to first reference them. This is done using the DOM-tree and DOM methods like document.getElementById(). If references are used more than once, one can store them in global variables, typically initialized by an onload event.