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
>
查看全文
相关阅读:
美的书,献给所有追求美的人
《WCF揭秘》:欢迎大家来找我的茬(有奖)!
这个寒冬,如何让我们的身价翻倍?
微软中文论坛周年Party掠影
ASP.NET 3.5之屠龙刀——《ASP.NET高级程序设计(第2版)》
Red Hat Linux指南
一部孟宪会推荐的C#图解教程
左菜单js效果
分享图标
谷歌hack
原文地址:https://www.cnblogs.com/HD/p/98815.html
最新文章
开源中Web开发的各种资源
IE Bugs 列表和解决方法
IE6 IE7 IE8 css bug兼容性解决方法总结归纳
(转)步步为营VS 2008 + .NET 3.5系列文章索引
c#中Dictionary、ArrayList、Hashtable和数组的区别是什么?[转]
C# Dictionary 泛型类例子
C# WinForm开发系列 文章索引
如何重装系统 windows xp?
C#事件
系统设计与规划一点总结
热门文章
C#委托
(收藏)《博客园精华集》WebService筛选结果(共79篇)
[转载] C# 泛型简介
C#中Abstract和Virtual
WinForm 中ComboBox 绑定总结
(收藏)《博客园精华集》分类索引
理解C#委托,事件与回调函数
TransactionScope使用说明
Web设计离不开的4项基本原则
前沿视频教室——《C#图解教程》是本好书,强烈推荐!
Copyright © 2011-2022 走看看