poche 发表于 2007-4-27 10:22:55

***图形特效***跟随鼠标的图片[修改图片名称及路径共2步]

把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件
====1、将以下的代码加入到heml的<head></head>之间:

<!-- 以下代码是设定smile的代码 -->
<script language="javascript">
var newtop=0
var newleft=0
if (navigator.appname == "netscape") {
layerstyleref="layer.";
layerref="document.layers";
styleswitch="";
}
else
{
layerstyleref="layer.style.";
layerref="document.all";
styleswitch=".style";
}
function domousemove() {
layername = 'iit'
eval('var curelement='+layerref+'["'+layername+'"]')
eval(layerref+'["'+layername+'"]'+styleswitch+'.visibility="hidden"')
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')
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
{
newleft=document.body.scrollleft + event.clientx

}
eval('curelement'+styleswitch+'.pixelleft=newleft')
if (event.clienty > (document.body.clientheight - 5 - height))
{
newtop=document.body.clientheight + document.body.scrolltop - 5 - height
}
else
{
newtop=document.body.scrolltop + event.clienty
}
eval('curelement'+styleswitch+'.pixeltop=newtop')
}
document.onmousemove = domousemove;
</script>

====2、将以下代码加入到heml的<body></body>之间:

<!-- 以下代码是设定此页的鼠标样式代码 -->
<script language="javascript">
if (navigator.appname == "netscape") {
}
else
{
document.write('<div id=outerdiv>')
document.write('<img id=iit src="想要显示的图片.gif" style="position:absolute;top:5pt;left:5pt;z-index:10;visibility:hidden;">')
document.write('http://code.ik8.com/html/想要显示的图片.gif</div>')
}
</script>
      










--------------------------------------

http://www.huoyue.com.cn 活跃网,活跃人群的论坛,访问活跃网,将给您带来意想不到的收获,还可以免费为您开论坛,让您免费拥有与朋友、网友交流的论坛。你是年轻人吗?你活跃你就上!
页: [1]
查看完整版本: ***图形特效***跟随鼠标的图片[修改图片名称及路径共2步]