在左下角弹出“数据处理”的提示层,分享下。跨框架,随屏滚动,IE6,7,8,FF测试没问题

bing475879749 2010-06-29 12:35:42
DOCTYPE 标准不能少,在IE6,7,8,FF测试通过,其它的没测试

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<title>test</title>
<body>
<script>
var istop;
if(window.parent && window.parent!=window){istop=top.window;}else{istop=window;}
function loadinginfo(){
var isIE = (document.all) ? true : false;
var isIE6 = isIE && ([/MSIE (\d)\.0/i.exec(navigator.userAgent)][0][1] == 6);
var Bind = function(object, fun) {
return function() {
return fun.apply(object, arguments);}
}
var w = istop.document.createElement("div");
w.setAttribute("id","mybody")
with(w.style){
position = "fixed";
zIndex = '10001';
bottom = 0;
left = 0;
width="300px";
height="20px";
backgroundColor="#FF0000";
lineHeight="20px";
fontSize="12px";
textAlign="center";
}
w.innerHTML="数据处理中,请稍候……"
if(isIE6){
w.style.position ="absolute";
w._fixed = Bind(w, function(){
w.style.marginTop = istop.document.documentElement.scrollTop - w.offsetHeight / 2 + "px";
w.style.marginLeft = istop.document.documentElement.scrollLeft+ "px";});
w._fixed()
istop.attachEvent("onscroll", w._fixed);
w.innerHTML =" 数据处理中,请稍候……"+'<iframe style="position:absolute; visibility:inherit; top:0px; left:0px; width:100%; height:100%; z-index:-1;filter:alpha(opacity=0);"></iframe>'
}
istop.document.body.appendChild(w);
}
function loadingClose(){
istop.document.body.removeChild(istop.document.getElementById("mybody"));
}
loadinginfo();
</script>
</body>
</html>
...全文
128 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
bing475879749 2010-06-29
  • 打赏
  • 举报
回复
要关闭就调用函数:loadingClose()
bing475879749 2010-06-29
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 bennman 的回复:]
而且你这样的效果IE6用 expression 就能搞定
[/Quote]

呵呵,你改进改进
bennman 2010-06-29
  • 打赏
  • 举报
回复
而且你这样的效果IE6用 expression 就能搞定
bennman 2010-06-29
  • 打赏
  • 举报
回复
我突然发现我白说了 用 postion:fixed 就能兼容除了IE6外所有的浏览器

而且你这个IE6效果有问题 有幻影!
bennman 2010-06-29
  • 打赏
  • 举报
回复
不错不错 帮你测了下

在IE678 FF3.63 chrome opera safari 都没问题 收藏了
hoojo 2010-06-29
  • 打赏
  • 举报
回复

呵呵~~~~不错!

87,917

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧