经典ASP页面中的加载屏幕 [英] Loading screen in classic ASP page

查看:124
本文介绍了经典ASP页面中的加载屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个传统的经典ASP页面,该页面需要很长时间才能加载.这是因为在加载之前,它必须运行大量的数据库查询.加载时间超过10秒.

I have a legacy classic ASP page that is taking a long time to load. This is because before loading it must run a large number of database queries. Load time is upwards of 10 seconds.

页面结构如下:

<% SQL Queries %>
<html>...Display the data from the queries..</html>

即,所有查询都在标记呈现之前发生.

ie, all the queries occur before the markup renders.

由于加载时间长,我想创建一个加载屏幕,该屏幕将在查询开始之前运行,并在查询结束时关闭,以向用户提供指示.我想知道如何做到这一点?我见过的示例(例如BlockUI)依赖于通过ajax调用的页面,但是使用标准的"a href"调用此特定页面.

Due to the long load times I want to create a loading screen that will run before the queries start and close when the queries end, to provide an indication to the user. I'm wondering how to do this? The examples I've seen (such as BlockUI) rely on the page being called through ajax, but this particular page is being called using a standard 'a href'.

谢谢.

推荐答案

经典ASP附带了方便的Response.Flush命令.此类代码将导致内容在SQL查询开始执行之前出现:

Classic ASP comes with the handy Response.Flush command. Such code will cause content to appear before the SQL queries start executing:

<%
Response.Write("<div id=""PleaseWaitPanel"">")
Response.Write("Processing, please wait...")
Response.Write("<img src=""please_wait.gif"" />")
Response.Write("</div>")
Response.Flush()
'SQL Queries...
%>

现在要在查询完成后将其隐藏,您需要简单的jQuery:

Now to hide it after queries are done you need simple jQuery:

<script type="text/javascript">
$(document).ready(function() {
    $("#PleaseWaitPanel").hide();
});
</script>

这篇关于经典ASP页面中的加载屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆