menu

天魔窟

勇往直前

Avatar

ASP FAQ # Chinese [3]

http://www.aspfaq.com/show.asp?id=2498

怎样显示一个“请等待”提示?

这里提供一个示例,技术上使用了 Response.Buffer 和 Response.Flush()。这个例子只能在支持“document.all”的浏览器中生效(即 IE 了...)你可以修改它以适应别的浏览器。(比如采用 getElementById 方法……)

<% Response.Buffer = True %> 
 
<html> 
<head> 
<title>Buffer test</title> 
</head> 
 
<body> 
 
<script> 
<!-- 
    if (document.all) 
    { 
        document.write("<span id=w>Please"); 
        document.write(" wait...</span>"); 
    } 
//--> 
</script> 
 
<% Response.Flush() %> 
 
<% 
    ' put your long-running processes here. 
    ' this should be enough to demonstrate: 
 
    for i = 1 to 1000000 
        x = x + 1 
    next 
%> 
 
<script> 
<!-- 
    if (document.all) 
    { 
        document.all("w").style.display = 'none'; 
    } 
//--> 
</script> 
 
</body> 
</html>


需要注意的是,Response.Flush 被包含在单独一个 <%...%> 中,必须酱子写,否则在 %> 出现之前它不起作用!

这个水平不高..提出批评,呵呵..

继续等待 ^_^

评论已关闭