Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q5826 Can I show a status display while my page is loading?

You are here: irt.org | FAQ | ASP | Q5826 [ previous next ]

Here's one way. The ASP code below writes a call to a client-side Javascript function that appends another * to the status window.

<script language='javascript'>
<!--// FIRST OPEN THE CHILD WINDOW
myFloater = window.open('statuspage.html','myWindow','scrollbars=no,
status=no,width=350,height=100')

// THIS CLIENT FUNCTION WRITES TEXT INTO
// THE CHILD WINDOW, A * IS WRITTEN EACH
// TIME IT'S CALLED.

function increment(runOnce) {
  if (runOnce == 1) {
    myFloater.document.write ("<font face='Verdana' size = 3>
    LOADING:</font><br>");
  }
  else {
    myFloater.document.write ("<font face='Verdana' size = 5>*<
    /font>");
  }
}
//-->
</script>
</head>
<body>
<%
' THIS IS THE SIMULATION OF AN
' AS SCRIPT THAT TAKES A LONG TIME
' TO EXECUTE.  EVERY 700 COUNTS, IT
' UPDATES THE STATUS WINDOW
Dim counter
counter = 0
splitVal = 700
for i = 1 to 10000
  if  (i mod splitVal) = 0 then
    if counter = 0 then
      response.write "<script>increment(1)</script>" &
      vbCrLf
      counter = 999
    else
      response.write "<script>increment(0)</script>" &
      vbCrLf
    end if
  end if
next

%>

Feedback on 'Q5826 Can I show a status display while my page is loading?'

©2018 Martin Webb