您的位置:首页 > 其它

在加载Web页面时显示正在等待的窗体

2012-09-24 21:15 525 查看
1.在css样式表里加入

/* 页面加载特效 */

.Loading

{

font-size: 12px;

font-family: 宋体;

width: 100pt;

height: 14pt;

position: absolute;

z-index: 3;

background-color: #f5f5f5;

cursor: wait;

border-right: #000000 1px ridge;

border-top: #000000 1px ridge;

border-left: #000000 1px ridge;

border-bottom: #000000 1px ridge;

filter: alpha(opacity=82);

-moz-opacity: 0.8;

opacity: 0.8;

left: expression((this.parentElement.offsetWidth-this.offsetWidth)/2);

top: expression((document.body.clientHeight-this.style.pixelHeight)/3+document.body.scrollTop);

}

.Loading_Close

{

CURSOR: hand;

color:#000000;

font-size:12px;

font-weight:bold;

margin-right:4px;

}

2.loading.js

//页面加载中效果开始

document.writeln("<div id=\"loadingDiv\" class=\"Loading\">");

document.writeln(" <table>");

document.writeln(" <tr>");

document.writeln(" <td align=\"right\">页面加载中请稍候  <span title=关闭 class=\"Loading_Close\" onClick=\"document.all.loadingDiv.style.display='none'\">×</span>");

document.writeln(" <\/td>");

document.writeln(" <\/tr>");

document.writeln(" <tr>");

document.writeln(" <td valign=\"middle\">");

document.writeln(" <img src=\"../images/Loading.gif\" border=\"0\" ><\/td>");

document.writeln(" <\/tr>");

document.writeln(" <\/table>");

document.writeln("<\/div>")

3.在<head>后加入

<link href="../Images/Style.css" rel="stylesheet" type="text/css">

<script language="JavaScript" type="text/javascript" src="/js/loading.js"></script>

<script type="text/javascript">

function Window_Load(Flag)

{

// debugger;

if (Flag == 0)

{

document.all['loadingDiv'].style.display = 'block';

//show the window

}

else

{

document.all['loadingDiv'].style.display = 'none';

//hide the window

}

}

</script>

4.在<form>上加入

<form id="form1" runat="server" method="post" onsubmit="Window_Load(0);">

5.在</html>上加入

<script language="JavaScript" type="text/javascript">Window_Load(1);</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: