javascript - JS在空白页面移动如何改变鼠标样式
ringa_lee
ringa_lee 2017-04-11 09:18:21
0
1
478

本来想做一个类似于像用鼠标控制windows窗口大小的功能,虽然后来功能可以实现,但是引申出一个疑问就是,怎么在空白页面鼠标移动时来改变鼠标样式呢?比如说这段代码,当clientX大于300时改变鼠标样式,我是加在了body身上,也没什么用,但是我加在document上直接就报错,说document是undefined

window.onload = function() {
    document.onmousemove=function(ev){
        var ev=ev||event;
        if(event.clientX>300){
            document.style.cursor='w-resize';
        }else
            document.style.cursor='auto';
    };
};
ringa_lee
ringa_lee

ringa_lee

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!