跟随鼠标的图片代码
将以下代码分别加入到网页的<head>蓝色字体部分</head>和<body>黄色字体部分</body>区域,绿色代码表示跟随鼠标的图片,可以替换成自己的图片,注意路径一定要正确。[4j7\)@!GE$BUi
[b]<html>[/b]3elE6i"D[a
[b]<head>.kt ZG*O \
[/b]<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>捌玖网络网页特效|[url]www.89w.org[/url]|---跟随鼠标的图片</title> BF9sS;I1@
[b][code]<script LANGUAGE="JavaScript">F!kE?e)\ MH
var newtop=0
var newleft=0
if (navigator.appName == "Netscape") {r^!h)u1cw
layerStyleRef="layer.";
layerRef="document.layers";
styleSwitch=""; AFR0G0pA(s
}
else
{
layerStyleRef="layer.style.";
layerRef="document.all";:R f!L:K!LQ
styleSwitch=".style";
}v*aW%~7o_^!Q!D
function doMouseMove() {p0W4g#hL:J
layerName = 'iit'7Bf$ym0C5l8G
eval('var curElement='+layerRef+'["'+layerName+'"]')
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')
eval('curElement'+styleSwitch+'.visibility="visible"'):x6imOn5\6uOe
eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')CKyRk,Q
eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')1X\9lx5Zs7maM8e
eval('height=curElement'+styleSwitch+'.height')'G \2ZTt4N5L
eval('width=curElement'+styleSwitch+'.width')ti9Z,G4r+}nZ4G
width=parseInt(width)2`)y E{\g^FX\
height=parseInt(height)`-j$s/dZ0lSF5nl
if (event.clientX > (document.body.clientWidth - 5 - width))
{+\;H-Inz8G n!^
newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width
}
else
{
newleft=document.body.scrollLeft + event.clientX
}
eval('curElement'+styleSwitch+'.pixelLeft=newleft')a C|Ws%C7rw*E
if (event.clientY > (document.body.clientHeight - 5 - height))
{a*i"r3nO)y2B0N'ia
newtop=document.body.clientHeight + document.body.scrollTop - 5 - height
}
elsetW7P/XHT5X4q1a)ML
{
newtop=document.body.scrollTop + event.clientY
} P'^$}V^g
eval('curElement'+styleSwitch+'.pixelTop=newtop')5Xm-y;W`.q.w
}
document.onmousemove = doMouseMove;
</script>t!Ws ^/E^Q%Mj[X
[/code][/b]
[b]</head>[/b]9bcYj4f-YD3cL-g
'lg*[uwG
[b]<body>9k9Jr wtR:Kh7~
[/b]<!-- 以下代码是设定此页的鼠标样式代码 -->
[b][code]<script language="javascript">
if (navigator.appName == "Netscape") {$y,V:at;qA;VbQ^5_r
}
else
{ kxv-p*}Dx"vM
document.write('<div ID=OuterDiv>')
document.write('<img ID=iit src="images/flag.gif" STYLE="position:absolute;TOP:5pt;LEFT:5pt;Z-INDEX:10;visibility:hidden;">')
document.write('</div>'):j|2ma1gQ)W
}
</script>
[/code][/b]
[b]</body>[/b]
[b]</html>[/b]
页:
[1]