跟随鼠标的图片代码
将以下代码分别加入到网页的<head>蓝色字体部分</head>和<body>黄色字体部分</body>区域,绿色代码表示跟随鼠标的图片,可以替换成自己的图片,注意路径一定要正确。_p:US6V k hS Y
[b]<html>[/b]
[b]<head>_'T7r!c%h
[/b]<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>捌玖网络网页特效|[url]www.89w.org[/url]|---跟随鼠标的图片</title>;r4kkI:B_
[b][code]<script LANGUAGE="JavaScript">
var newtop=0
var newleft=0
if (navigator.appName == "Netscape") { d3_0OCf8n)p.h/O
layerStyleRef="layer.";
layerRef="document.layers";
styleSwitch="";
}
elseK$j-Q.F$U-XL
{
layerStyleRef="layer.style.";.Euj"p'J#S#[
layerRef="document.all";
styleSwitch=".style";8V]0k9Z*xn
}
function doMouseMove() {
layerName = 'iit'
eval('var curElement='+layerRef+'["'+layerName+'"]')
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')8`+GFTS^?-X$vCLA[
eval('curElement'+styleSwitch+'.visibility="visible"')
eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')
eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')
eval('height=curElement'+styleSwitch+'.height')%T%p(@py:cs&ST8u
eval('width=curElement'+styleSwitch+'.width')
width=parseInt(width)
height=parseInt(height)
if (event.clientX > (document.body.clientWidth - 5 - width))
{
newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width
}
else{g'Pi%gO8}
{
newleft=document.body.scrollLeft + event.clientXI*cDT'k yA7^ifs c]
}.z{&Vo Q ]-u
eval('curElement'+styleSwitch+'.pixelLeft=newleft')L#R7mc'gk
if (event.clientY > (document.body.clientHeight - 5 - height))m|6T Q7O'e X9x
{
newtop=document.body.clientHeight + document.body.scrollTop - 5 - height
}
else~PQC ^$pC2X(VW7}
{
newtop=document.body.scrollTop + event.clientYW&G-lL*{p3d/D3g.^
}
eval('curElement'+styleSwitch+'.pixelTop=newtop')MA-O7K+n ^N
}
document.onmousemove = doMouseMove;
</script>
[/code][/b]mT{]u3h
[b]</head>[/b]&c?{3N!r f"y+_Dck
W;l-vq-`p+N$q
[b]<body> yY?1p!x;IQ_
[/b]<!-- 以下代码是设定此页的鼠标样式代码 -->3GFg:J}(m5T^
[b][code]<script language="javascript">-K(MOMA;LLc
if (navigator.appName == "Netscape") {
}
else
{
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>NS(l2E)iQd-rFt
[/code][/b]
[b]</body>[/b]2k)w-e8Yf ^ ?
[b]</html>[/b]
页:
[1]