博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
js 弹出框 替代浏览器的弹出框
阅读量:5267 次
发布时间:2019-06-14

本文共 1399 字,大约阅读时间需要 4 分钟。

function fromID(id) {
return document.getElementById(id);
}
function
show_alert(msg, type, time) {
var layer_obj = fromID("alert_layer");
var layer_text= fromID("alert_text");
var line_height = (document.documentElement.scrollTop == 0) ? document.body.scrollTop : document.documentElement.scrollTop;
layer_text.innerHTML = msg;
with(layer_obj.style) {
zIndex = 999;
top = line_height-40;
left = document.body.clientWidth/3;
display = "block";
position = "absolute";
if(type == "error") {
background = "url(http://"+style_domain+"/snake/index/msgbox_right_bg2.jpg)";
}
}
layer_obj.filters[0].opacity = "0.8"; //透明度为 80%
if(time == undefined) time = 3000;
else time = time*1000;
var top = line_height-40;
var speed = 1.5;
time-= 1000;
//控制窗口向下移动至页面边缘
move_down = function MoveFplogo() {
top+= speed;
layer_obj.style.top = top;
if(top < line_height) setTimeout("move_down()", 1);
else setTimeout("close_alert_win()", time);
}
move_down();
}
function close_alert_win() {
var layer_obj = fromID("alert_layer");
//控制窗口渐渐消失
if(layer_obj.filters[0].opacity < 0.02) {
layer_obj.style.display = "none";
return true;
}
layer_obj.filters[0].opacity-= 0.02;
setTimeout("close_alert_win()", 1);
}
document.writeln("
filter:progid:DXImageTransform.Microsoft.BasicImage();">");
document.writeln("
");
document.writeln(" ");
document.writeln("
");

 

转载于:https://www.cnblogs.com/yesmadom/archive/2010/10/28/1863587.html

你可能感兴趣的文章
Jmeter接口压力测试,Java.net.BindException: Address already in use: connect
查看>>
Leetcode Balanced Binary Tree
查看>>
go:channel(未完)
查看>>
[JS]递归对象或数组
查看>>
LeetCode(17) - Letter Combinations of a Phone Number
查看>>
路由器外接硬盘做nas可行吗?
查看>>
python:从迭代器,到生成器,再到协程的示例代码
查看>>
Java多线程系列——原子类的实现(CAS算法)
查看>>
多线程《三》进程与线程的区别
查看>>
linux sed命令
查看>>
html标签的嵌套规则
查看>>
[Source] Machine Learning Gathering/Surveys
查看>>
HTML <select> 标签
查看>>
类加载机制
查看>>
tju 1782. The jackpot
查看>>
湖南多校对抗赛(2015.03.28) H SG Value
查看>>
hdu1255扫描线计算覆盖两次面积
查看>>
hdu1565 用搜索代替枚举找可能状态或者轮廓线解(较优),参考poj2411
查看>>
bzoj3224 splay板子
查看>>
程序存储问题
查看>>