跟随鼠标的图片代码
将以下代码分别加入到网页的<head>蓝色字体部分</head>和<body>黄色字体部分</body>区域,绿色代码表示跟随鼠标的图片,可以替换成自己的图片,注意路径一定要正确。[b]<html>[/b]
[b]<head>
[/b]<meta http-equiv="Content-Type" content="text/html; charset=gb2312">m\Zl Z:c kle
<title>捌玖网络网页特效|[url]www.89w.org[/url]|---跟随鼠标的图片</title>,FwZ(GE-n \ A
[b][code]<script LANGUAGE="JavaScript">
var newtop=02NV Q!TP K1g*a/V2xI
var newleft=0
if (navigator.appName == "Netscape") {
layerStyleRef="layer.";
layerRef="document.layers";
styleSwitch="";BS!LoV%_!zIt.\0Y
}
else
{5e7`X.x}
layerStyleRef="layer.style.";
layerRef="document.all";
styleSwitch=".style";"^6RK!gj4N V
}3cqs{(H
function doMouseMove() {
layerName = 'iit'|*wW4[I5hdVM
eval('var curElement='+layerRef+'["'+layerName+'"]')
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')3m,U){ F1\;si hHI
eval('curElement'+styleSwitch+'.visibility="visible"')s,HBlN/y$p5N
eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')
eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')/YQl6Y|Ox
eval('height=curElement'+styleSwitch+'.height')?3GX#c ]7V
eval('width=curElement'+styleSwitch+'.width')
width=parseInt(width)5{px9`xg
height=parseInt(height)
if (event.clientX > (document.body.clientWidth - 5 - width))]7vr}%S-xI
{
newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width'I+dY%bJ
}
else
{c;uk:D8g"Z
newleft=document.body.scrollLeft + event.clientXG q3w9?2TH&v}c
}
eval('curElement'+styleSwitch+'.pixelLeft=newleft')Y/c7`[Y-|j1i'@
if (event.clientY > (document.body.clientHeight - 5 - height))gT%_ ^? {n]
{
newtop=document.body.clientHeight + document.body.scrollTop - 5 - heightldb;Avtd1Y3Q
}
else2Z T1g_["Ua+Q
{*RI/h?4O2x
newtop=document.body.scrollTop + event.clientY
}
eval('curElement'+styleSwitch+'.pixelTop=newtop')"nE4S[/E Xr/e9j%`
}
document.onmousemove = doMouseMove;_1e0`OF6k}UQu
</script>M$U6q9|*S_ y|
[/code][/b]
[b]</head>[/b]
[b]<body>*{(FVO8Wg
[/b]<!-- 以下代码是设定此页的鼠标样式代码 -->;TT5|YJ[? c8@
[b][code]<script language="javascript">N%RSj e"F
if (navigator.appName == "Netscape") {
}
elsex1`7S7@r b~'AL
{
document.write('<div ID=OuterDiv>') b(W!?fD _.h6J
document.write('<img ID=iit src="images/flag.gif" STYLE="position:absolute;TOP:5pt;LEFT:5pt;Z-INDEX:10;visibility:hidden;">'),s#h n:xt bj.MU
document.write('</div>').lA:Px3R]3^
}
</script>
[/code][/b]G!G:W%]A
[b]</body>[/b]
[b]</html>[/b]
页:
[1]