加载页面时更改光标

pso*_*res 15 html javascript css

所以我想要做的是将光标更改为等待某个页面加载时等待.

我认为这可以用css,我试图在有人点击某个链接时实现这一点,所以我拥有的是:

#something a:hover { cursor: hand; }
#something a:active { cursor: wait; }
Run Code Online (Sandbox Code Playgroud)

但是这不起作用,当悬停链接时它是一只手,当等待一秒钟时,我希望这种等待继续直到新页面出现.

所以我的问题是:这是错的吗?实现我想要的?
或者我必须使用JavaScript?

Bas*_*sic 25

这样做的方法是这样的:

在第一页(单击链接时显示):

<a href="http://www.example.com/Page2.html" onclick="document.body.style.cursor='wait'; return true;">
Run Code Online (Sandbox Code Playgroud)

在第二页(显示直到新页面加载完成):

<script type="text/javascript">
    // Set the cursor ASAP to "Wait"
    document.body.style.cursor='wait';

    // When the window has finished loading, set it back to default...
    window.onload=function(){document.body.style.cursor='default';}
</script>
Run Code Online (Sandbox Code Playgroud)