zoukankan
html css js c++ java
[JavaScript]公告DIV实现
公告窗口如果用弹出式窗口的话,有可能会被些什么上网助手给屏蔽了!所以写了个公告DIV的JS。
演示地址:
http://blog.csdn.net/bgu/
代码如下:(放入到Body区域即可)
<
div id
=
"
affiche
"
ondblclick
=
"
closeDiv();
"
style
=
"
BORDER-RIGHT: black 1px outset; BORDER-TOP: black 1px outset; BORDER-LEFT: black 1px outset; WIDTH: 30%; CLIP: rect(auto auto auto auto); BORDER-BOTTOM: black 1px outset; POSITION: absolute; HEIGHT: 30%; BACKGROUND-COLOR: whitesmoke; TEXT-ALIGN: center;
"
align
=
"
center
"
>
<
table height
=
"
100%
"
width
=
"
100%
"
>
<
tr
>
<
td vAlign
=
"
middle
"
align
=
"
center
"
height
=
"
100%
"
>
此处为公告内容
<
div id
=
"
timeout
"
></
div
>
</
td
>
</
tr
>
</
table
>
</
div
>
<
script language
=
"
javascript
"
>
var
intOut
=
10
;
TimeDiv();
function
closeDiv()
{
document.getElementById(
"
affiche
"
).style.display
=
"
none
"
;
}
function
TimeDiv()
{
--
intOut;
if
( intOut
>
1
)
{
window.setTimeout(
"
TimeDiv()
"
,
1000
);
document.getElementById(
"
timeout
"
).innerText
=
intOut
+
"
秒后/双击窗口自动关闭!
"
;
}
else
{
closeDiv();
}
}
var
objDiv
=
document.getElementById(
"
affiche
"
);
SetDiv();
function
SetDiv()
{
objDiv.style.top
=
(document.body.offsetHeight
-
objDiv.offsetHeight)
/
2
+
document.body.scrollTop;
objDiv.style.left
=
(document.body.offsetWidth
-
objDiv.offsetWidth)
/
2
;
if
( intOut
>
1
)
{
window.setTimeout(
"
SetDiv()
"
,2
00
);
}
}
</
script
>
查看全文
相关阅读:
Deep Learning--分布式训练RBM算法框架
Deep Learning基础理论--Classification RBM
docker run hangs问题排查记录
启用k8s metrics server监控
Infiniband 网络性能测试
foreman容器化部署
通过keepalived实现多主集群方案
工程优化暨babel升级小记
一次由webview报错引起的追根溯源
前端基础3:js篇(基础及算法)
原文地址:https://www.cnblogs.com/HD/p/98815.html
最新文章
扩展django的User的部分方法
一个登录页面的实现
2021——面试小结(2)
2021——面试小结(1)
C# Equals方法和==有什么区别
未能找到源类型“DbSet<T>”的查询模式的实现。未找到“Select”
最详尽的 JS 原型与原型链终极详解(1)(2)(3)===转载
什么是MVC
初识Redis以及Linux下安装redis
初始Linux_基本目录
热门文章
生产者消费者问题
Hexo start
线程同步(重点)
观测线程状态
多线程_线程礼让
多线程_模拟抢票
多线程静态代理_
MySQL的表分区(转载)
ConcurrentHashMap的实现
互联网金融--对于近来行业新闻的一些整理与思考
Copyright © 2011-2022 走看看