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
>
查看全文
相关阅读:
《Erlang程序设计》 第六章 编译并运行程序
《Erlang程序设计》第二章 入门
《Erlang程序设计》第一章 引言
《Erlang程序设计》第四章 异常
animation的控件动画效果
各种自定义动画效果
loding等待时的一些效果
逐渐显示的按钮和图片上下切换
Android的系统架构
【转】overridePendingTransition 动画切换效果
原文地址:https://www.cnblogs.com/HD/p/98815.html
最新文章
Java 调用 Eclipse的编译器 JDT
GWT中复制到剪贴板
GWT多模块间解耦合调用(一)
摩根IT笔试
CSS覆盖height注意事项,暨Chrome插件的使用
[转载]用C/C++访问Microsoft Access数据库
MS Access替代工具试用
网页上的Javascript编辑器和代码格式化
编写高质量的CSS代码,规范建议
为什么建议将浏览器私有CSS3属性写在前面,标准属性写在后面?
热门文章
JavaScript Repeater 模板控件
在Windows 系统上构建从github获得的jquery源码
ajax设计模式,唯一 URL 模式
简易Pinterest/瀑布流布局
在FIREBUG控制台中输入 jQuery() 返回 []
通用无缝连续滚动JS
前端模块化协作
css hack应该使用吗?
《Erlang程序设计》第三章 顺序型编程
《Erlang程序设计》第五章 顺序型编程进阶
Copyright © 2011-2022 走看看