<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< Html Xmlns = "Http://www.w3.org/1999/xhtml" >
< Head >
< Title > No title page </ Title >
< Script Language = "JavaScript" >
Function Mouseposition (EV ){
If (EV. pagex | Ev. Pagey ){
Return {X: eV. pagex, Y: eV. Pagey };
}
Return {
X: eV. clientx + Document. Body. scrollleft - Document. Body. clientleft,
Y: eV. clienty + Document. Body. scrolltop - Document. Body. clienttop
};
}
Function Mousemove (EV ){
EV = EV | Window. event;
VaR Mousepos = Mouseposition (EV );
Document. getelementbyid ( ' Xxx ' ). Value = Mousepos. X;
Document. getelementbyid ( ' Yyy ' ). Value = Mousepos. Y;
}
Document. onmousemove=Mousemove;
Function Show (EL ){
VaR X = Parseint (document. getelementbyid ( ' Xxx ' ). Value) - El. offsetleft;
VaR Y = Parseint (document. getelementbyid ( ' Yyy ' ). Value) - El. offsettop;
X = " X: " + X;
Y = " Y: " + Y;
Alert (x + " , " + Y );
}
</ Script >
</ Head >
< Body >
X: < Input ID = "XXX" Type = "Text" /> Y: < Input ID = "Yyy" Type = "Text" />
< IMG ID = "Imgpic" SRC = "Cpu.jpg" Onclick = "Show (this )" />
</ Body >
</ Html >