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
>
查看全文
相关阅读:
HTML5---offline application(application cache)
apache asp.net
长轮询
comet ajax轮询
bootstrap3
weixin
backbone csdn
backbone case
backbone showcase
javascript performance
原文地址:https://www.cnblogs.com/HD/p/98815.html
最新文章
mahout 实现canopy
开发Blog整理
excle查找操作-vlookup的使用心得
具体解释C++引用——带你走进引用的世界
Mongodb集群之副本集
使用bbed恢复表数据
POJ 2528 Mayor's posters 离散化和线段树题解
[Apple开发者帐户帮助]二、管理你的团队(4)离开一个团队
[Apple开发者帐户帮助]二、管理你的团队(3)删除团队成员
[Apple开发者帐户帮助]二、管理你的团队(2)更改团队成员角色
热门文章
[Apple开发者帐户帮助]二、管理你的团队(1)邀请团队成员
[Apple开发者帐户帮助]一、开始(3)账户信息
[Apple开发者帐户帮助]一、开始(2)登录您的开发者帐户
[Apple开发者帐户帮助]一、开始(1)关于您的开发者帐户
[Swift]LeetCode523. 连续的子数组和 | Continuous Subarray Sum
[Swift]LeetCode522. 最长特殊序列 II | Longest Uncommon Subsequence II
[Swift]LeetCode519. 随机翻转矩阵 | Random Flip Matrix
java service
MIME
HTML5 Geolocation
Copyright © 2011-2022 走看看