IE7 Cannot dynamic load custom cursor

Recently I play around custom cursor and find this problem. IE seems cannot dynamically load custom cursor. But no problem for preload custom cursor and dynamically load build-in cursor. Here is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">

<script language="javascript">
function clickButton()
{
document.getElementById("divTest").style.cursor = "crosshair";
}
function clickButton1()
{
document.getElementById("divTest").style.cursor = "hand";
}
function clickButton2()
{
document.getElementById("divTest").style.cursor = "url('Arrow.red.cur');";
}
</script>
<title>test_cursor</title>


</head>
<body>
<form>
<button onclick="clickButton()" id="1" value="1" name="1" type="button" text="1">crosshair</button>
<button onclick="clickButton1()" id="2" value="2" name="2" type="button" text="2">hand</button>
<button onclick="clickButton2()" id="3" value="3" name="3" type="button" text="3">Arrow.red</button>

<div style="width:400;height:300;background-color:blue;cursor:url('Arrow.red.cur');" id=divTest>
</div>

<div style="width:400;height:300;background-color:red;cursor:url('Arrow.blue.cur');" id=divTest1>
</div>
</form>
</body>
</html>

Arrow.blue.cur and Arrow.red.cur are two customize cursor. Click the button "Arrow.red" will not work, but others no problem.

Anyone has ideas




Answer this question

IE7 Cannot dynamic load custom cursor

  • AdriaanDavel

    Thanks, Sergey. It works great. before(or for other version of IE) I have to use two preloaded cursor divs, one on top of the other and switch them accordingly.

  • Vince P

    try that function :)
    function clickButton2()
    {
    document.getElementById("divTest").style.cursor = "Arrow.red.cur";
    }

    thinking it's working well for ie7 - tested

  • IE7 Cannot dynamic load custom cursor