Fortunately, everything is available on the Internet. I found a function with the best browser compatibility online. It has been tested to be compatible with IE, FireFox, and Chrome, and there is no scroll bar error problem. Save it for future use:)
function mousePos(e){
var x,y;
var e = e||window.event;
return {
x:e.clientX document.body.scrollLeft document.documentElement.scrollLeft,
y:e.clientY document.body.scrollTop document .documentElement.scrollTop
};
}
Note: This function is used in conjunction with the onmousemove event.
Function source: mouse follow prompt box by nunumick
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn