::NoName Magazine 无名杂志 » 水也无名 » 上下移动的广告代码


2006-7-13 13:47 Sai
上下移动的广告代码

动来动去怪不舒服的,做个备份
[code]
<script language='JavaScript'>
var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);

function getRef(id) {
if (isDOM) return document.getElementById(id);
if (isIE4) return document.all[id];
if (isNS4) return document.layers[id];
}

var isNS = navigator.appName == 'Netscape';

function moveRightEdge() {
var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;

if (isNS4) {
yMenuFrom = Scroll.top;
yMenuTo = windows.pageYOffset + 260;
} else if (isDOM) {
yMenuFrom = parseInt (Scroll.style.top, 10);
yMenuTo = (isNS ? window.pageYOffset : document.body.scrollTop) + 77;
}
timeoutNextCheck = 100;

if (yMenuFrom != yMenuTo) {
yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
if (yMenuTo < yMenuFrom)
yOffset = -yOffset;
if (isNS4)
Scroll.top += yOffset;
else if (isDOM)
Scroll.style.top = parseInt (Scroll.style.top, 10) + yOffset;
timeoutNextCheck = 1;
}
setTimeout ('moveRightEdge()', timeoutNextCheck);
}
</SCRIPT>
<DIV id="Scrollmemu" style="width:67px; position:absolute; z-index:3; left:860px;">
<a href="http://saicn.com/nnm24" target="_blank"><img src="http://saicn.com/bbs/new/nnm24.jpg"></a>
  <SCRIPT language=javascript>
if (isNS4) {
var Scroll = document['Scrollmemu'];
Scroll.top = top.pageYOffset + 300;
Scroll.visibility = 'visible';
moveRightEdge();
} else if (isDOM) {
var Scroll = getRef('Scrollmemu');
Scroll.style.top = (isNS ? window.pageYOffset : document.body.scrollTop) + 300;
Scroll.style.visibility = 'visible';
moveRightEdge();
}
</SCRIPT>
</div>

</div>

[/code]

2006-7-13 16:52 xlfdll
还不错……JavaScript
基本上读懂了……

页: [1]
查看完整版本: 上下移动的广告代码


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.