i have written this code, i am facing the problem of attaching the mouse cordinates with the mouse pointer, i have import an external file of svg in html through an object tag, the problem is that when i mouseover on the svg element the coordinates are not being displayed on the svg element,with the mouse pointer i am using a span tag to display the coordinates and i have hide the visibility of the span tag...Please help me out...! Thanks in advance Zain
Code...
<body>
<span id="trail" style="visibility:hidden"></span>
<object id="obj" data="example.svg" width="1000" height="500">
</object>
</body>
<script type="text/javascript">
var x=0;
var y=0;
var ff=document.getElementById("obj");
ff.addEventListener("load",function(){
var contentdoc=ff.contentDocument;
var cicle=contentdoc.getElementById("rect");
cicle.onmousemove=function(event)
{
document.getElementById('trail').style.visibility="visible";
document.getElementById('trail').style.position="absolute";
document.getElementById('trail').style.left=event.clientX+10;
document.getElementById('trail').style.top=event.clientY;
x=event.clientX-400
y=event.clientY-255
document.getElementById("trail").innerHTML="X-Axis"+x+", Y-Axis"+y
}