求HTML鼠标指针代码

求HTML鼠标指针代码,第1张

鼠标上变化的文字

脚本说明:

把如下代码加入<body>区域中

<SCRIPT language="JavaScript1.2">

<!--

var scroller_msg='Hi,网络编程站欢迎你的光临!'

var dismissafter=0

var initialvisible=0

if (document.all)

document.write('<marquee id="curscroll" style="position:absolutewidth:150pxborder:1px solid blackfont-size:14pxbackground-color:whitevisibility:hidden">'+scroller_msg+'</marquee>')

function followcursor(){

//move cursor function for IE

if (initialvisible==0){

curscroll.style.visibility="visible"

initialvisible=1

}

curscroll.style.left=document.body.scrollLeft+event.clientX+10

curscroll.style.top=document.body.scrollTop+event.clientY+10

}

function dismissmessage(){

curscroll.style.visibility="hidden"

}

if (document.all){

document.onmousemove=followcursor

document.ondblclick=dismissmessage

if (dismissafter!=0)

setTimeout("dismissmessage()",dismissafter*1000)

}

//-->

</SCRIPT>

================================

鼠标箭头效果

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var x, y, xold, yold, xdiff, ydiff

var dir = Array()

dir[0] = "n-resize"

dir[1]="ne-resize"

dir[2]="e-resize"

dir[3]="se-resize"

dir[4] = "s-resize"

dir[5]="sw-resize"

dir[6]="w-resize"

dir[7]="nw-resize"

document.onmousemove = FindXY

function display(direction) {

document.body.style.cursor = dir[direction]

}

function FindXY(loc) {

x = (document.layers) ? loc.pageX : event.clientX

y = (document.layers) ? loc.pageY : event.clientY

xdiff = x - xold

ydiff = y - yold

if ((xdiff < 2) &&(ydiff <-2)) display(0)

if ((xdiff < 2) &&(ydiff > 2)) display(4)

if ((xdiff > 2) &&(ydiff < 2)) display(2)

if ((xdiff <-2) &&(ydiff < 2)) display(6)

if ((xdiff > 2) &&(ydiff > 2)) display(3)

if ((xdiff > 2) &&(ydiff <-2)) display(1)

if ((xdiff <-2) &&(ydiff > 2)) display(5)

if ((xdiff <-2) &&(ydiff <-2)) display(7)

xold = x

yold = y

}

// End -->

</script>

你还,指针cur文件的路径,你写绝对路径试试。

style="cursor:url(你的域名/images/Arrow.cur)"

Arrow.cur 写你的域名+/images/Arrow.cur。写完整的url路径


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/7172841.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-02
下一篇 2023-04-02

发表评论

登录后才能评论

评论列表(0条)

保存