I have a nasty feeling that <embed> may work differently to other HTML elements here. My code works fine for any element which isn't my graph
Any suggestions?
Code: Select all
<script type="text/javascript">
window.onload = init;
function init(){
document.getElementById("graph").onmousemove = mousemove;
}
function mousemove(evt){
if(!evt){
evt = window.event;
}
document.getElementById("coords").innerHTML = "X = " + evt.clientX + ", Y = " + evt.clientY;
}
</script>
If I use the id of the fieldset which has the graph and a bunch of other stuff in, I get coordinates when I'm pointing at anything which isn't the graph, which is why I'm suspicious that embed is different...do I need the Javascript in the svg file instead?
I'm pretty new to Javascript - can anyone point me at an example?
(Not worried about the actual values I'm displaying yet - I'm aware that there are browser incompatibilites and so on. I'm just trying to get something to display at this stage.)