下面这段拿去研究研究把
网页头部下拉js代码:<div id="ad" style="position:absolute"> <a href="http://www.ke8.cn" target="_blank"> <img src="/ad/botongp.gif" border="0"> </a> </div>
<script language=JavaScript>
var x = 80,y = 80
var xin = true, yin = true
var step = 1
var delay = 10
var obj=document.getElementById("ad")
function floatAD() {
var L=T=0
var R= document.body.clientWidth-obj.offsetWidth
//var B = document.body.clientHeight-obj.offsetHeight
var B = document.documentElement.clientHeight
obj.style.left = x + document.documentElement.scrollLeft
obj.style.top = y + document.documentElement.scrollTop
x = x + step*(xin?1:-1)
if (x < L) { xin = true; x = L}
if (x > R){ xin = false; x = R}
y = y + step*(yin?1:-1)
if (y < T) { yin = true; y = T }
if (y > B) { yin = false; y = B }
}
var itl= setInterval("floatAD()", delay)
obj.onmouseover=function(){clearInterval(itl)}
obj.onmouseout=function(){itl=setInterval("floatAD()", delay)}
</script>
<script type="text/javascript">
function showWWPopup() {
var wp = document.getElementById('WWPopup');
var anim = function(){
n += 5;
if(n >= 180){
wp.style.marginTop = '0';
window.clearInterval(tt);
}else{
wp.style.marginTop = "-"+(180 - n)+"px";
}
},n=0;
var tt = window.setInterval(anim, 100);
}
function hideWWPopup() {
var wp = document.getElementById('WWPopup');
var anim = function(){
n += 5;
if(n >= 180){
wp.style.marginTop = '-180px';
window.clearInterval(tt);
}else{
wp.style.marginTop = "-"+n+"px";
}
},n=0;
var tt = window.setInterval(anim,200);
return false;
}
function initWWPopup() {
var wp = document.createElement('div');
wp.id = 'WWPopup';
wp.style.marginTop = '-180px';
document.body.insertBefore(wp, document.getElementById('Head'));
wp.innerHTML = ' <object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="760" height="180"> <param name="movie" value="other/adflash.swf" /> <param name="quality" value="high" /> <param name="SCALE" value="exactfit" /> <embed src="other/adflash.swf" width="760" height="180" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" scale="exactfit"> </embed> </object>';
showWWPopup();
}
initWWPopup();
setTimeout("hideWWPopup()",18000);
</script> |