-1
I want to use the value within a function outside of it. I have the global variable, and as it is a variable that is never the same, it presents it. I tested it, and it only worked once with the undifined value, because the function was not executed.
var circle_x;
function deselectElement(evt){
if(selectedElement != 0){
selectedElement.parentNode.removeAttributeNS(null, "onmousemove");
selectedElement.removeAttributeNS(null, "onmouseup");
selectedElement = 0;
dx=evt.clientX;
//objet 1
if(selectedLineX == 1){
circle_x=currentX;
}
}
}
alert(circle_x);
Probably did not work because it is extremely difficult to manage global variables: http://answall.com/a/32252/101. And if it is not possible to get the information you that, ie if you do not enter this
if
, the function must return what?– Maniero
The function serves to unselect an SVG object. When the cursor is wide.
– akm
Can you show more of your code? There are variables there that you can’t see where they come from.
– Sergio
Did the answer help? Do you think you should accept it?
– Maniero