设为首页
加入收藏
帮助中心
首页 | 红盾通告 | 信息中心 | ASP技术 | 数据库 | 网页设计 | 网管专栏 | OICQ攻略 | 墨客频道 | 网站运营 |
当前位置:首页 >> 网页设计 >> Javascript >> 正文
最新信息
·Javascript处理数字的几个…
·判断当前网页是否为本站页…
·鼠标指上图片替换后出现下…
·逍遥狼无图片智能圆角
·javascript获取当前网页文…
·用javascript获得地址栏参…
·JavaScript常用判断函数
·双击鼠标滚动屏幕的代码
·web应用漏洞扫描工具Jikto…
·常备JS操作
资料搜索
热点信息
·js获取图片尺寸
·怎么让弹出窗口最大化
·web应用漏洞扫描工具Jikto…
·判断radio多个单选按纽中是…
·如何用文字做一个只刷新验…
·防止F5刷新执行onunload事…
·Javascript获取IE浏览器窗…
·关闭IE时调用onbeforeunlo…
·js表单提交验证
·javascript获取当前网页文…
推荐信息
·显示日期方式
·添加到收藏夹
·终极应用--弹出的窗口之Co…
·防止被人frame
·web应用漏洞扫描工具Jikto…
·JavaScript常用的一些验证…
·关闭IE时调用onbeforeunlo…
·js表单提交验证
·自己综合其他资料写的一套…
·window.open具体参数


Google
 
有没有看过会旋转的链接?
〖编辑:Cloudy | 浏览:人次〗

要完成此效果需要两个步骤

第一步:把如下代码加入到<head>区域中

<style>
.fly {
color:          336c6c;
font-family:    arial;
font-size:      24px;
position:       absolute;
visibility:     hidden;
z-index:        2;
}

.logo {
font-family:    times;
font-size:      48px;
color:          blue;
position:       absolute;
top:            0px;
left:           70px;
visibility:     visible;
z-index:        1;
}

.desc {
text-align:     center;
font-family:    楷体_GB2312;
font-size:      18px;
color:          #336c6c;
position:       absolute;
top:            220px;
left:           140px;
width:          400px;
visibility:     hidden;
z-index:        0;
}

BODY {
background:     #c0c0c0;
}

A {
color:          lime;
}

A:HOVER {
    color : yellow;
   
}
</style>
<script LANGUAGE="JavaScript">
    ns4 = (document.layers)? true:false
    ie4 = (document.all)? true:false

function showObject(obj) {
    if (ns4) obj.visibility = "show"
    else if (ie4) obj.visibility = "visible"
    }

function hideObject(obj) {
    if (ns4) obj.visibility = "hide"
    else if (ie4) obj.visibility = "hidden"
    }

function slideLogo(from, to) {
            if (from < to) {
                company.top = (from += 10);
                setTimeout('slideLogo(' + from + ',' + to + ')', 20);
            }
            else initObjects();
    }


function rotateObjects() {
            for (var i = 0; i < pos.length; i++) {
                pos[i] += inc; objects[i].visibility = 'visible';
                objects[i].left = (r * Math.cos(pos[i])) + xoff
                objects[i].top = (r * Math.sin(pos[i])) + yoff;
            }
        rotateTimer = setTimeout("rotateObjects()", 50);
    }


function initObjects() {

        objects = new Array(fly1, fly2, fly3, fly4);
        pos = new Array();
        pos[0] = 0;
            for (var i = 1; i < objects.length; i++) {
                pos[i] = parseFloat(pos[i - 1] + ((2 * pi) / objects.length));
            }
        rotateObjects();
    }

/* Variables for rotating objects */
    var objects;
    var pos;
    var r = 160;        // radius
    var xoff = 280;     // x offset
    var yoff = 170;     // y offset
    var pi = Math.PI;   // get pi
    var inc = pi / 180; // degrees per rotation cycle
    var objects;        // objects to be rotated
    var pos;            // position for objects


</script>


第二步:把如下代码加入到<body>区域中

<div ID="fly1" CLASS="fly"><p>

<a HREF="#" onMouseOver="showObject(desc1)"
onMouseOut="hideObject(desc1)">link 1</a><br>
</p>
</div><div ID="fly2" CLASS="fly"><p>

<a HREF="#" onMouseOver="showObject(desc2)"
onMouseOut="hideObject(desc2)">link 2</a><br>
</p>
</div><div ID="fly3" CLASS="fly"><p>

<a HREF="#" onMouseOver="showObject(desc3)"
onMouseOut="hideObject(desc3)">link 3</a><br>
</p>
</div><div ID="fly4" CLASS="fly"><p>

<a HREF="#" onMouseOver="showObject(desc4)"
onMouseOut="hideObject(desc4)">link 4</a><br>
</p>
</div><div ID="company" CLASS="logo">

  <p><small>WELCOME TO Typhoon Start</small></p>
</div><div ID="desc1" CLASS="desc">

<p>link 1的内容 </p>
</div><div ID="desc2" CLASS="desc">

<p>link 2的内容 </p>
</div><div ID="desc3" CLASS="desc">

<p>link 3的内容 </p>
</div><div ID="desc4" CLASS="desc">

<p>link 4的内容 </p>
</div><script LANGUAGE="JavaScript">
    /* Simple version detection */
    var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4);
/* They can be used in place
       of hidden and visible because on occasion Navigator has problems with the two */
    var HIDDEN = (isNS) ? 'hide' : 'hidden';
    var VISIBLE = (isNS) ? 'show' : 'visible';

    /* Create shortcut variables for different absolutely positioned elements */
    var fly1 = (isNS) ? document.fly1 : document.all.fly1.style;
    var fly2 = (isNS) ? document.fly2 : document.all.fly2.style;
    var fly3 = (isNS) ? document.fly3 : document.all.fly3.style;
    var fly4 = (isNS) ? document.fly4 : document.all.fly4.style;
    var company = (isNS) ? document.company : document.all.company.style;
    var desc1 = (isNS) ? document.desc1 : document.all.desc1.style;
    var desc2 = (isNS) ? document.desc2 : document.all.desc2.style;
    var desc3 = (isNS) ? document.desc3 : document.all.desc3.style;
    var desc4 = (isNS) ? document.desc4 : document.all.desc4.style;

    /* Begin the sliding of the company logo */
    slideLogo(0, 140);
</script>


录入时间:2006-06-20 12:48:43 [打印本页] [关闭窗口] [返回顶部]
特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。

Copyright © 2006-2014 0733168.Com Inc All Rights Reserved
关于我们 | 广告合作 | 联系我们 | 法律声明 | 友情链接 | 意见反馈
本站所收录信息、社区话题、及本站所做之广告均属其个人行为,与本站立场无关
湘ICP备06008436号