PDA

View Full Version : Progress bar


kendel
05-28-2003, 08:04 PM
Can someone please show me how to make a progress bar?

When user click the search button, I want the progress bar displays while waiting for the returning records.

Thanks.

skriptkiddie
05-30-2003, 09:36 AM
Taken from http://www.aspin.com/func/content-search?id=4403610&qry=progress+bar

<%@ Language=VBScript %>
<%

sub ShowOrderStatus(Status,graph,comment)
Response.Write "<BR>" '& Status
dim state,text,bgcolor
dim bgcolor1,bgcolor2,bgcolor3,bgcolor4,bgcolor5,bgcolor6,bgcolor7,bgcolor8
dim text1,text2,text3,text4,text5,text6,text7,text8,text0

'initialize
state = 0
text = ""
bgcolor="#00FF00"

'cell colors
bgcolor0 = "#f1f1f1"
bgcolor1 = "#00E055"
bgcolor2 = "#22C055"
bgcolor3 = "#44A055"
bgcolor4 = "#668055"
bgcolor5 = "#886055"
bgcolor6 = "#AA4055"
bgcolor7 = "#CC2055"
bgcolor8 = "#EE0055"
bgcolor9 = "#FF0000"

'text messages
text0 = "-- N.A --"
text1 = "Text 1"
text2 = "Text 2"
text3 = "Text 3"
text4 = "Text 4"
text5 = "Text 5"
text6 = "Text 6"
text7 = "Text 7"
text8 = "Text 8"
text9 = "Text 9"

if Status = "" or Status = Null then
Status = 0
end if

state = Status
text = eval("text" & Status)

dim TableWidth, CellWidth
TableWidth = "100"
CellWidth = (TableWidth)/8

if graph = 1 then
Response.Write "<table width="&TableWidth&" height=5 cellpadding=1 cellspacing=1 bgcolor=white class=table_border_thin>" & vbCrLf
Response.Write "<tr align=left nowrap>"

if state <> 9 then
IF state >=1 THEN Response.Write "<td width="&CellWidth&" title="""& text1 &""" bgcolor="& bgcolor1 &"></td>" & vbCrLf
IF state >=2 THEN Response.Write "<td width="&CellWidth&" title="""& text2 &""" bgcolor="& bgcolor2 &"></td>" & vbCrLf
IF state >=3 THEN Response.Write "<td width="&CellWidth&" title="""& text3 &""" bgcolor="& bgcolor3 &"></td>" & vbCrLf
IF state >=4 THEN Response.Write "<td width="&CellWidth&" title="""& text4 &""" bgcolor="& bgcolor4 &"></td>" & vbCrLf
IF state >=5 THEN Response.Write "<td width="&CellWidth&" title="""& text5 &""" bgcolor="& bgcolor5 &"></td>" & vbCrLf
IF state >=6 THEN Response.Write "<td width="&CellWidth&" title="""& text6 &""" bgcolor="& bgcolor6 &"></td>" & vbCrLf
IF state >=7 THEN Response.Write "<td width="&CellWidth&" title="""& text7 &""" bgcolor="& bgcolor7 &"></td>" & vbCrLf
IF state >=8 THEN Response.Write "<td width="&CellWidth&" title="""& text8 &""" bgcolor="& bgcolor8 &"></td>" & vbCrLf
IF state < 8 THEN Response.Write "<td width="&(8 - state)* CellWidth &" colspan="& (8 - state) &" bgcolor="& bgcolor0 &"></td>" & vbCrLf
else
Response.Write "<td width="& (8)* CellWidth &" colspan=8 title="""& text9 &""" bgcolor="& bgcolor9 &"></td>" & vbCrLf
end if

Response.Write "</tr>" & vbCrLf
Response.Write "</table>"
end if

if comment = 1 then
Response.Write text
end if
end sub
%>

Example :
<%
call ShowOrderStatus(4,1,0)
%>

kendel
05-30-2003, 12:40 PM
Let me test it.

kendel
05-30-2003, 07:41 PM
Can you tell me how does it work? When I hit the "search" button, it will call another page. All it does is showing an image of a bar, that it, no progressing at all.

Thanks.