zoukankan
html css js c++ java
首页头部下拉广告设计(javascript)
加在Head中
<
script type
=
"
text/javascript
"
language
=
"
javascript
"
>
var
intervalId
=
null
;
function
slideAd(id,nStayTime,sState,nMaxHth,nMinHth)
{
this
.stayTime
=
nStayTime
*
1000
||
3000
;
this
.maxHeigth
=
nMaxHth
||
330
;
//
广告最大高度
this
.minHeigth
=
nMinHth
||
1
;
this
.state
=
sState
||
"
down
"
;
var
obj
=
document.getElementById(id);
if
(intervalId
!=
null
)window.clearInterval(intervalId);
function
openBox()
{
var
h
=
obj.offsetHeight;
obj.style.height
=
((
this
.state
==
"
down
"
)
?
(h
+
5
) : (h
-
5
))
+
"
px
"
;
if
(obj.offsetHeight
>
this
.maxHeigth)
{
window.clearInterval(intervalId);
intervalId
=
window.setInterval(closeBox,
this
.stayTime);
}
if
(obj.offsetHeight
<
this
.minHeigth)
{
window.clearInterval(intervalId);
obj.style.display
=
"
none
"
;
}
}
function
closeBox()
{
slideAd(id,
this
.stayTime,
"
up
"
,nMaxHth,nMinHth);
}
intervalId
=
window.setInterval(openBox,
2
);
}
<
/
script>
加在Body下面
<
div
id
="slideAD"
style
="overflow: hidden; height: 0; padding-left:10px; 985px"
><
div
id
="hd"
><
img
src
="/img/close.gif"
alt
="关闭"
onclick
="slideAd('slideAD',5,'up');return false;"
/></
div
>
<
div
align
="center"
>这里插入相应的图片或flash
</
script
></
div
>
</
div
>
设置当页面完全加载之后执行,10MS 检测一次
<
script type
=
"
text/javascript
"
>
<!--
function
chk()
{
(
this
.document.readyState
==
"
complete
"
)
?
slideAd(
'
slideAD
'
,
8
):setTimeout(
'
chk()
'
,
10
);
}
chk();
//
-->
<
/
script>
查看全文
相关阅读:
PostgreSQL查看等待锁的SQL和进程
effective_io_concurrency很重要的一个参数
PostgreSQL逻辑复制到kafka-实践
Linux下路由配置梳理(转)
创建B树,动态添加节点,并使用三种遍历算法对树进行遍历
思考--PostgreSQL在与mysql的比较中稍微弱势项
思考-继续思考在数据库中两个表join的问题
思考--mysql 分库分表的思考
超级实用的网址大全
C++ 读取txt文本内容,并将结果保存到新文本
原文地址:https://www.cnblogs.com/kingboy/p/1042374.html
最新文章
面试题(六)
HTTP协议头部与Keep-Alive模式详解
面试题(五)爬虫
面试题(四)爬虫
面试题(三)
面试题(二)
建造者模式
抽象工厂模式
Postman(二)、调试模式
Postman(一)、断言
热门文章
Jmeter(五)关联之正则表达式提取器
Jmeter(四)Cookie管理器
Jmeter(三) 从上传图片来入门Jmeter
Jmeter(二) Jmeter组件介绍
python3.6+selnium3+IE11问题及解决方法
Moco 详解
python3.6+Xadmin2.0系列(一) xadmin下载及安装
python virtualenv 虚拟环境
在PostgreSQL中 pg_start_backup 做了什么?
PostgreSQL SQL优化之NOT IN问题
Copyright © 2011-2022 走看看