<! 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>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Meta http-equiv = "X-UA-Compatible" content = "IE = EmulateIE7"/>
<Meta name = "auther" content = "fq"/>
<Title> obtain mouse coordinates </title>
</Head>
<Body>
<Script type = "text/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;
</Script>
X: <input id = "xxx" type = "text"/> Y: <input id = "yyy" type = "text"/>
</Body>
</Html>