|
-
Aug 11th, 2006, 12:05 PM
#1
Thread Starter
Fanatic Member
popup loading window
i want to popup a window for the user that shows 'Loading, please wait...'
in a window while my process is loading records and when it is finished the window closes automatically..
how to do this ?
-
Aug 12th, 2006, 01:34 AM
#2
Re: popup loading window
You should look into controlling the buffer.
but i'm not particularly sure on how to implement it. just an idea, to one of the directions you can take.
-
Aug 12th, 2006, 05:09 AM
#3
PowerPoster
Re: popup loading window
this isnt a pop up but shows a div with "Loading .. please wait"
you can make it go whereever you want just change the DIV's top, left, etc
Code:
<%@ Language="VBScript" %>
<%
Option Explicit
Response.Buffer = False '// <-- IMPORTANT
'// SHOW THE LOADING
Function ShowLoading()
Dim tmp: tmp = ""
tmp = tmp & "<div id=""loading"" style=""position:absolute;width:171px;height:32px;top:250px;left:300px;"">" & vbCrLf
tmp = tmp & "<table border=""1"" cellpadding=""0"" cellspacing=""0"" width=""170"" height=""32"" bordercolor=""#333333"">" & vbCrLf
tmp = tmp & " <tr><td width=""168"" height=""32"" bgcolor=""navy"" align=""center"">" & vbCrLf
tmp = tmp & " <font face=""Verdana"" color=""#FFFFFF"" size=""2"">Loading .. please wait</font><br>" & vbCrLf
tmp = tmp & " </td></tr></table>" & vbCrLf
tmp = tmp & "</div>" & vbCrLf
ShowLoading = tmp
End Function
'// FINISHED LOADING
Function HideLoading()
Dim tmp: tmp = ""
tmp = "<Script Language=""JavaScript""> document.getElementById(""loading"").style.visibility = ""hidden"" </script>"
HideLoading = tmp
End Function
'// SIMPLE DELAY - optional
Function usrDelay(nSeconds)
Dim nStoptime
nStoptime = Timer + nSeconds
Do While Timer <= nStoptime: Loop
End Function
Sub MainScript()
Dim i, str
Response.Write (ShowLoading) '// START LOADING
'// TESTING SCRIPT - this just so it takes some time to load is all
For i = 0 To 1000
'// THIS JUST SLOWS THINGS DOWN FOR THE TEST
Response.Write ("<!-- <table><tr><td></td></tr></table> -->" & vbCrLf)
'// THIS IS THE DATA IM CREATING TO DISPLAY AFTER LOADING
str = str & " - " & CLng(i*10000) & vbCrLf
Next
'// usrDelay (3) '// OPTIONAL DELAY
Response.Write (HideLoading) '// END LOADING
Response.Write str '// WRITE MY TEST DATA NOW
End Sub
%>
<html>
<head>
</head>
<body topmargin="0" leftmargin="0">
<table border="0" cellpadding="0" cellspacing="0" width="740" height="500" bgcolor="#C0C0C0">
<tr><td width="100%"><% MainScript %></td></tr>
</table>
</body>
</html>
Last edited by rory; Aug 12th, 2006 at 05:16 AM.
-
Aug 12th, 2006, 06:14 AM
#4
PowerPoster
Re: popup loading window
the above only seems to work well with FireFox, that or my IE is messed up ..
anwyay here it is with a popup ...
you can use any type of popup, i just used a self creating one for this example .. change the HTML to whatever you want, or use an external page.
Code:
<%@ Language="VBScript" %>
<%
Option Explicit
Response.Buffer = False
'// SHOW THE LOADING
Function LoadingInit()
Dim tmp: tmp = "" & vbCrLf
tmp = tmp & "<Script Language=""JavaScript"">" & vbCrLf
tmp = tmp & "function show_loading() {" & vbCrLf
tmp = tmp & " loading_window = window.open(""""," & vbCrLf
tmp = tmp & " ""loading"",""left=600,top=300,width=185,height=25,resizable=0,location=0,menubar=0,scrollbars=0,status=0,toolbar=0"");" & vbCrLf
tmp = tmp & " loading_window.document.write(""" & HTML & """);" & vbCrLf
tmp = tmp & " loading_window.resizeTo(185,30);" & vbCrLf
tmp = tmp & " loading_window.moveTo(600,300);" & vbCrLf
tmp = tmp & "}" & vbCrLf
tmp = tmp & "function hide_loading() {" & vbCrLf
tmp = tmp & " if(false == loading_window.closed) {" & vbCrLf
tmp = tmp & " loading_window.close();"
tmp = tmp & " }" & vbCrLf
tmp = tmp & "}" & vbCrLf
tmp = tmp & "show_loading();" & vbCrLf
tmp = tmp & "</script>" & vbCrLf
LoadingInit = tmp
End Function
Function HTML()
Dim tmp: tmp = ""
tmp = tmp & "Loading .. please wait"
HTML = tmp
End Function
'// FINISHED LOADING
Function HideLoading()
Dim tmp: tmp = ""
tmp = "<Script Language=""JavaScript""> hide_loading(); </script>"
HideLoading = tmp
End Function
Sub MainScript()
Dim i, str
Response.Write (LoadingInit) '// START LOADING
'// TESTING SCRIPT - this just so it takes some time to load is all
For i = 0 To 1000
Response.Write ("<!-- <table><tr><td></td></tr></table> -->" & vbCrLf)
str = str & " - " & CLng(i*10000) & vbCrLf
Next
Response.Write (HideLoading) '// END LOADING
Response.Write str '// WRITE MY TEST DATA NOW
End Sub
%>
<html>
<head>
</head>
<body topmargin="0" leftmargin="0">
<table border="0" cellpadding="0" cellspacing="0" width="740" height="500" bgcolor="#C0C0C0">
<tr><td width="100%"><% MainScript %></td></tr>
</table>
</body>
</html>
-
Aug 12th, 2006, 10:10 AM
#5
Thread Starter
Fanatic Member
Re: popup loading window
this is exactly what I was looking for - thank you, Rory !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|