搜虎精品社区

标题: 网页头部的下拉图片怎么做? [打印本页]

作者: a415734243    时间: 2010-12-6 16:39
标题: 网页头部的下拉图片怎么做?
看到很多网站都有下拉框,就是打开首页之后会在头部以上出现一张图片,图片上写“热烈祝贺######”  什么的,然后过个几秒钟就自动缩回去的那种,那样的效果怎么实现啊?
作者: callyin    时间: 2010-12-16 14:56
下面这段拿去研究研究把


网页头部下拉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>
作者: 910661715    时间: 2010-12-17 10:30
JS呀。伸缩的效果
作者: liyangjun520    时间: 2010-12-18 08:00
只为几几个虎B
作者: liyangjun520    时间: 2010-12-18 08:00
虎B 哈哈.逗
作者: a415734243    时间: 2010-12-28 00:25
问题已经解决了·  谢谢····
作者: thlggddla    时间: 2011-3-11 15:02
我也来学习了,呵呵。




欢迎光临 搜虎精品社区 (https://souho.net/) Powered by Discuz! X3.2