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
>
查看全文
相关阅读:
2015年工作中遇到的问题:21-30(这10个问题很有价值)
简要总结最近遇到的5个问题
简要总结最近遇到的5个问题
我到底要选择一种什么样的生活方式,度过这一辈子呢:人生自由与职业发展方向(下)
我到底要选择一种什么样的生活方式,度过这一辈子呢:人生自由与职业发展方向(下)
IT咨询服务-客户案例(四):根据图片等素材,动态生成个性化图片
IT咨询服务-客户案例(四):根据图片等素材,动态生成个性化图片
分布式系统若干经验总结
分布式系统若干经验总结
最近遇到的若干技术问题
原文地址:https://www.cnblogs.com/HD/p/98815.html
最新文章
[Swift]LeetCode218. 天际线问题 | The Skyline Problem
[Swift]LeetCode216. 组合总和 III | Combination Sum III
[Swift]LeetCode215. 数组中的第K个最大元素 | Kth Largest Element in an Array
[Swift]LeetCode214. 最短回文串 | Shortest Palindrome
[Swift]LeetCode213. 打家劫舍 II | House Robber II
[Swift]LeetCode212. 单词搜索 II | Word Search II
[Swift]LeetCode211. 添加与搜索单词
[Swift]LeetCode210. 课程表 II | Course Schedule II
[Swift通天遁地]二、表格表单-(9)快速创建一个美观强大的表单
[Swift通天遁地]二、表格表单-(8)快速实现表单的输入验证
热门文章
使用URL dispatcher的范例
代码重构技巧方法
【翻译自mos文章】即使resource_limit = false, password的 资源限制也会生效
【腾讯bugly干货分享】精神哥手把手教你怎样智斗ANR
C++ HOJ 火车进站
依赖属性
三国人物共现网络
JavaScript数组的某些操作(一)
poj 2559 Largest Rectangle in a Histogram 栈
hdu 2841 Visible Trees(容斥原理)
Copyright © 2011-2022 走看看