精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>网络专区>>● 网站建设>>盖世神功 — 网站建设技术>>Java Script — 来一杯热咖啡>>旋转的文本--DHTML实例

主题:旋转的文本--DHTML实例
发信人: surpassboy()
整理人: eagle(2000-09-30 01:04:10), 站内信件
第一步:把下面的脚本插入<head>与</head>之间:
<STYLE>
.fly {
POSITION: absolute; VISIBILITY: hidden; Z-INDEX: 2
}
.logo {
 LEFT: 231px; POSITION: absolute; TOP: 130px; VISIBILITY: visible; 
Z-INDEX: 1
}
.desc {
 COLOR: #006600; FONT-FAMILY: 宋体; LEFT: 235px; POSITION: absolute; 
TEXT-ALIGN: center; TOP: 355px; VISIBILITY: hidden; WIDTH: 100px
}
a:active {  font-family: "宋体"; font-size: 9pt; color: #006600; 
text-decoration: none}
a:hover {  font-family: "宋体"; font-size: 9pt; color: #00FF00; 
text-decoration: underline}
a:link {  font-family: "宋体"; font-size: 9pt; color: #006600; 
text-decoration: none}
a:visited {  font-family: "宋体"; font-size: 9pt; color: #006600; 
text-decoration: none}
body {  font-size: 9pt; color: #006600}
</STYLE>
<SCRIPT language=JavaScript>
    function showObject(object) {
        object.visibility = VISIBLE;
    }
    function hideObject(object) {
        object.visibility = HIDDEN;
    }
    function slideLogo(from, to) {
            if (from < to) {
company.top = (from += 10);
setTimeout('slideLogo(' + from + ',' + to + ')', 75);
}
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()", 75);
}
function initObjects() {
objects = new Array(fly1, fly2, fly3, fly4, fly5);
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();
}
var objects;
var pos;
var r = 148; // 旋转的半径
var xoff = 260; // 旋转的X座标
var yoff = 150; // Y座标
var pi = Math.PI; //
var inc = pi / 180;
var objects;
var pos;
</SCRIPT>
<script language="JavaScript1.2">
function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",50);
showObject(desc6);
}
function low(which2){
clearInterval(highlighting)
which2.filters.alpha.opacity=70;
hideObject(desc6);
}
function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=3
else if (window.highlighting)
clearInterval(highlighting)
}
</script>

第二步:把下面的脚本插入<body>与</body>之间:
<div class=fly id=fly1><a href="http://oke.yeah.net" onmouseout=hideObject(
desc1) onmouseover=showObject(desc1) target="_blank" >网页作坊<br>  //以
下为旋转的文本
</div>
<DIV class=fly id=fly2><a href="#" onmouseout=hideObject(desc2) onmouseover=
showObject(desc2)>链接2<BR>
</DIV>
<DIV class=fly id=fly3><a href="#"onmouseout=hideObject(desc3) onmouseover=s
howObject(desc3)>链接3<BR>
</DIV>
<DIV class=fly id=fly4><a href="#" onmouseout=hideObject(desc4) onmouseover=
showObject(desc4)>链接4<BR>
</DIV>
<DIV class=fly id=fly5><a href="#" onmouseout=hideObject(desc5) onmouseover=
showObject(desc5)>链接5<BR>
</DIV>
<DIV class=logo id=company style="z-index: 1">
  <p>网页作坊---技术中心</p>
  <p>DHTML之旋转的文本</p>
  <p>这里也可以是图象!</p>
</DIV>
<DIV class=desc id=desc1>网页作坊</DIV>  //以下改成你的链接说明
<DIV class=desc id=desc2>链接说明2</DIV>
<DIV class=desc id=desc3>链接说明3</DIV>
<DIV class=desc id=desc4>链接说明4</DIV>
<DIV class=desc id=desc5>链接说明5</DIV>
<SCRIPT language=JavaScript>
    var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVer
sion) >= 4);
    var HIDDEN = (isNS) ? 'hide' : 'hidden';
    var VISIBLE = (isNS) ? 'show' : 'visible';
    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 fly5 = (isNS) ? document.fly5 : document.all.fly5.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;
    var desc5 = (isNS) ? document.desc5 : document.all.desc5.style;
    slideLogo(-200, 130);  //下降开始与结束的位置
</SCRIPT>
详细代码和实例请参阅以下的网址:
http://www.3wtimes.com/shi/pape/center2/dhtml/text/eddy1.htm

--
寒竹(surpass) OICQ:222822
欢迎光临网页作坊--专为网页制作者度身而做的网站!
    网眼天下:收集优秀的设计、技术、素材、免费酷站   
    技术中心:动态网页制作实例
    缤纷网页:最酷的页面效果
网址:http://oke.t500.net http://oke.yeah.net

※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.188.74]
※ 修改:.eagle 于 Feb 29 14:03:51 修改本文.[FROM: 202.96.190.124]

[关闭][返回]