Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change the cursor to an image?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hiyo~
Does any of u know how to change the mouse cursor to an image in Dreamweaver? I know how to change the cursor into crosshair shape and such, but I've no idea how to replace the cursor with an image...
 
Try pasting the relevant bits into your page.

IE4+ and NN4+ allow to capture the mouse move event and then to
position an image as needed to let it follow the mouse cursor:

<HTML>
<HEAD>
<STYLE>
#imgLayer { position: absolute; visibility: hidden; }
</style>
<SCRIPT>
var imgURL =
'var started = false;
function moveHandler (evt) {
if (document.layers) {
var l = document.imgLayer;
if (l) {
l.left = window.pageXOffset + evt.pageX + 1;
l.top = window.pageYOffset + evt.pageY + 1;
if (!started) {
started = true;
l.visibility = 'show';
}
}
}
else if (document.all) {
var l = document.all.imgLayer;
if (l) {
l.style.pixelLeft = document.body.scrollLeft + event.x + 1;
l.style.pixelTop = document.body.scrollTop + event.y + 1;
if (!started) {
started = true;
l.style.visibility = 'visible';
}
}
}
else if (document.getElementById) {
var l = document.getElementById('imgLayer');
if (l) {
l.style.left = window.pageXOffset + evt.clientX + 1 + 'px';
l.style.top = window.pageYOffset + evt.clientY + 1 + 'px';
if (!started) {
started = true;
l.style.visibility = 'visible';
}
}
}
}
function initEvents () {
if (document.layers)
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = moveHandler;
}
initEvents();
</script>
</head>
<BODY>
<SPAN ID=&quot;imgLayer&quot;>
<SCRIPT>
document.write('<IMG SRC=&quot;' + imgURL + '&quot;>');
</script>
</span>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top