跟随鼠标的图片代码
将以下代码分别加入到网页的<head>蓝色字体部分</head>和<body>黄色字体部分</body>区域,绿色代码表示跟随鼠标的图片,可以替换成自己的图片,注意路径一定要正确。[b]<html>[/b]3atw"|6Mt9`
[b]<head>
[/b]<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>捌玖网络网页特效|[url]www.89w.org[/url]|---跟随鼠标的图片</title>%S)fd;?fYZ
[b][code]<script LANGUAGE="JavaScript">"z,Npaz
var newtop=0
var newleft=0b`{|g@N
if (navigator.appName == "Netscape") {
layerStyleRef="layer.";
layerRef="document.layers";
styleSwitch="";
}
else
{
layerStyleRef="layer.style.";+f-c~3z#BKwa'g
layerRef="document.all";,_LTe+k9R;x
styleSwitch=".style";
}
function doMouseMove() {
layerName = 'iit'&J+y9Oy(A]&`[
eval('var curElement='+layerRef+'["'+layerName+'"]')
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')
eval('curElement'+styleSwitch+'.visibility="visible"')
eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')l-o-ZXq4iK5aa `N
eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')
eval('height=curElement'+styleSwitch+'.height')7V$Fy"c0}0E2g(V
eval('width=curElement'+styleSwitch+'.width')
width=parseInt(width)
height=parseInt(height)qLaqN'Z-C9R|
if (event.clientX > (document.body.clientWidth - 5 - width))
{i0HmG-y:jj
newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width
}
else
{Pak'})L+G1W[z$q
newleft=document.body.scrollLeft + event.clientX
}
eval('curElement'+styleSwitch+'.pixelLeft=newleft')8K.f8a L@ wj-V%MM bV
if (event.clientY > (document.body.clientHeight - 5 - height))Yw#UG wg#r
{*@z x/J {!ER,wL
newtop=document.body.clientHeight + document.body.scrollTop - 5 - heightr1sNM]&` naj5K
}
else:h7d,]ND ~R
{
newtop=document.body.scrollTop + event.clientY:F8pHh {m$K7e.D
}
eval('curElement'+styleSwitch+'.pixelTop=newtop')C#T U|zN6k
}
document.onmousemove = doMouseMove;*Q;vU9f5H2aO
</script>
[/code][/b]
[b]</head>[/b]
I(I8?;DX:x C/Zt
[b]<body> j}"Dw;\3vK1P
[/b]<!-- 以下代码是设定此页的鼠标样式代码 -->.i"Jl2`r)K{| Y
[b][code]<script language="javascript">M-?0k S)Df
if (navigator.appName == "Netscape") {p8S C-Zf_4Z7Y
}
else
{*R@p0k'?@2R~
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>')
}
</script>
[/code][/b]
[b]</body>[/b]
[b]</html>[/b]
页:
[1]