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>
查看全文
相关阅读:
C#4.0和VS2010新特性
对于大型公司项目平台选择j2ee的几层认识
移动开发
第四讲 GridView 72般绝技
String字符串补0或空格
org.apache.commons.io使用实例
BigDecimal
JAVA String.format 方法使用介绍
SimpleDateFormat使用详解
java四舍五入
原文地址:https://www.cnblogs.com/kingboy/p/1042374.html
最新文章
我的程序员之路2012在匍匐中前进
我的程序员之路2012在匍匐中前进 分类: 程序人生 20130127 06:34 1237人阅读 评论(1) 收藏
【ASP.NET开发】.NET三层架构简单解析
Stage2 predicate 是不是肯定要Tablescan?
巧用CTE来实现生成10000行数据
SPA 小记
Hello, DB2
fedroa 编译安装mysql5.5
ssh时出现 Agent admitted failure to sign using the key
php5.3安装
热门文章
用wget命令在本地创建一个网站的镜像
solr实现满足指定距离范围条件的搜索
vim中实现javascript代码自动完成功能
org.quartz.SchedulerException: Couldn't get host name! [See nested exception: java.net.UnknownHostException:
vim中实现CSS、HTML代码自动完成功能
mysql重置auto_increment字段
改变PS1颜色,以及在shell中显示调整文字的颜色
uva256超时了,怎么回事啊?求解答
uva299
uva272
Copyright © 2011-2022 走看看