首页  韩国资源  酷站加油  我的展厅  设计名站  古典元素  推荐下载  设计欣赏  每周专访  招募精英  人才专区  网页教程  平面设计  编程开发  设计竞赛
当前位置:首页 > 网页教程 > HTMLCSS教程 > 正文
Google
跟随鼠标的图片的网页代码
 2006年07月29日 12:34 网友评论:0条 点击:
<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>
<script language="javascript">
    if (navigator.appName == "Netscape") {
    }
    else
    {
        document.write('<div ID=OuterDiv>')
document.write('<img ID=iit src="图片地址" STYLE="position:absolute;TOP:5pt;LEFT:5pt;Z-INDEX:10;visibility:hidden;">')
        document.write('</div>')
    }
</script>
上一篇:Mozilla Firefox 建议的CSS书写顺序   下一篇:JavaScript实现网页图片等比例缩放
收藏此页】【打印】【关闭
 相关文章  我要点评

免责声明:本站刊载此文不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。对本文有任何异议,请联络:68design#163.com
转载要求:作者及来源信息必需保留。转载之图片、文件,链接请不要盗链到本站,且不准打上各自站点的水印。



关于我们 | 在线反馈 | 广告报价 | 友情链接 | 联系我们 | 免责声明 | 在线投稿 | 网站地图
Copyright © 2003-2007 68design.net, All Rights Reserve 【找网页设计师,当然上网页设计师联盟】