Edit in JSFiddle

function doCircle1() {
document.getElementById("myRect1").y.baseVal.value = 30;
// alternative kullanım
//document.getElementById("myRect1").setAttribute("y","20px");
document.getElementById("myRect2").y.baseVal.value = 10;
}
function doCircle2() {
document.getElementById("myRect1").y.baseVal.value = 10;
document.getElementById("myRect2").y.baseVal.value = 30;
 }
<svg width="500px" height="120px">
  <rect id="myRect1" x="10px" y="10px" width="100px" height="100px" onclick="doCircle1()"/>
  <rect id="myRect2" x="120px" y="10px" width="100px" height="100px" fill="red" onclick="doCircle2()"/>
</svg>