ASP 101 - Active Server Pages 101 - Web05
The Place ASP Developers Go!

Please visit our partners


Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates














ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash





ASP Source Code:
<%
Sub DisplayProgressBarHtmlTable(sglPercentComplete, intWidth)
	Dim intBarLength
	If 0 <= sglPercentComplete And sglPercentComplete <= 100 Then
		' Compensate for the width of the table border
		intBarLength = intWidth - 4
		Response.Write "<table border=""1"" cellspacing=""0"" cellpadding=""0""><tr><td>"
		Response.Write "<table width=""" & intBarLength & """ border=""0"" cellspacing=""0"" cellpadding=""0"">"
		Response.Write "<tr><td width=""" & Round(sglPercentComplete * intBarLength / 100) & """ style=""background-color:#0000FF""> </td><td> </td></tr>"
		Response.Write "</table>"
		Response.Write "</td></tr></table>"
	End If
End Sub
Sub DisplayProgressBarIEesque(sglPercentComplete, intWidth)
	Dim intBarLength
	If 0 <= sglPercentComplete And sglPercentComplete <= 100 Then
		' Compensate for the width of the two end images
		intBarLength = intWidth - 8
		Response.Write "<img src=""images/progress_ie_left.gif""  border=""0"" height=""17"" width=""4"">"
		Response.Write "<img src=""images/progress_ie_green.gif"" border=""0"" height=""17"" width=""" & Round(sglPercentComplete * intBarLength / 100) & """ alt=""" & sglPercentComplete &  "%"">"
		Response.Write "<img src=""images/progress_ie_white.gif"" border=""0"" height=""17"" width=""" & (intBarLength - Round(sglPercentComplete * intBarLength / 100)) &  """ alt=""" & (100 - sglPercentComplete) &  "%"">"
		Response.Write "<img src=""images/progress_ie_right.gif"" border=""0"" height=""17"" width=""4"">"
	End If
End Sub
Sub DisplayProgressBarBlueGrey(sglPercentComplete, intWidth)
	Dim intBarLength
	If 0 <= sglPercentComplete And sglPercentComplete <= 100 Then
		' Compensate for the width of the two end images
		intBarLength = intWidth - 6
		Response.Write "<img src=""images/progress_bluegrey_left.gif""  border=""0"" height=""16"" width=""3"">"
		Response.Write "<img src=""images/progress_bluegrey_full.gif""  border=""0"" height=""16"" width=""" & Round(sglPercentComplete * intBarLength / 100) & """ alt=""" & sglPercentComplete &  "%"">"
		Response.Write "<img src=""images/progress_bluegrey_empty.gif"" border=""0"" height=""16"" width=""" & (intBarLength - Round(sglPercentComplete * intBarLength / 100)) &  """ alt=""" & (100 - sglPercentComplete) &  "%"">"
		Response.Write "<img src=""images/progress_bluegrey_right.gif"" border=""0"" height=""16"" width=""3"">"
	End If
End Sub
Sub DisplayProgressBarIE(sglPercentComplete, intNumberOfChunks)
	Dim intFilledChunks
	Dim I
	If 0 <= sglPercentComplete And sglPercentComplete <= 100 Then
		intFilledChunks = Round(sglPercentComplete * intNumberOfChunks / 100)
		Response.Write "<img src=""images/progress_ie_left.gif""  border=""0"" height=""17"" width=""4"">"
		For I = 1 To intNumberOfChunks
			If I <= intFilledChunks Then
				Response.Write "<img src=""images/progress_ie_full.gif""  border=""0"" height=""17"" width=""8"" alt=""" & sglPercentComplete &  "%"">"
			Else
				Response.Write "<img src=""images/progress_ie_empty.gif"" border=""0"" height=""17"" width=""8"" alt=""" & (100 - sglPercentComplete) &  "%"">"
			End If
		Next
		Response.Write "<img src=""images/progress_ie_right.gif"" border=""0"" height=""17"" width=""4"">"
	End If
End Sub
Sub DisplayProgressBarClassic(sglPercentComplete, intNumberOfChunks)
	Dim intFilledChunks
	Dim I
	If 0 <= sglPercentComplete And sglPercentComplete <= 100 Then
		intFilledChunks = Round(sglPercentComplete * intNumberOfChunks / 100)
		Response.Write "<img src=""images/progress_classic_left.gif""  border=""0"" height=""16"" width=""2"">"
		For I = 1 To intNumberOfChunks
			If I <= intFilledChunks Then
				Response.Write "<img src=""images/progress_classic_full.gif""  border=""0"" height=""16"" width=""10"" alt=""" & sglPercentComplete &  "%"">"
			Else
				Response.Write "<img src=""images/progress_classic_empty.gif"" border=""0"" height=""16"" width=""10"" alt=""" & (100 - sglPercentComplete) &  "%"">"
			End If
		Next
		Response.Write "<img src=""images/progress_classic_right.gif"" border=""0"" height=""16"" width=""2"">"
	End If
End Sub
%>
<h3>Progress Bars</h3>
<p><strong>HTML Table Version:</strong></p>
<% DisplayProgressBarHtmlTable 65.37, 150 %>
<br />
<p><strong>IE-esque Solid Version:</strong></p>
<% DisplayProgressBarIEesque 65.37, 150 %>
<br /><br />
<p><strong>Generic Blue/Grey Version:</strong></p>
<% DisplayProgressBarBlueGrey 65.37, 150 %>
<br /><br />
<p><strong>IE Version:</strong></p>
<% DisplayProgressBarIE 65.37, 17 %>
<br /><br />
<p><strong>Classic Version:</strong></p>
<% DisplayProgressBarClassic 65.37, 14 %>
<br /><br /><br />
<p><strong>Note:</strong> It's simple to change the percentage and bar length:</p>
<% DisplayProgressBarIEesque   0, 100 %> 0% @ 100px<br /><br />
<% DisplayProgressBarIEesque  25, 150 %> 25% @ 150px<br /><br />
<% DisplayProgressBarIEesque  50, 200 %> 50% @ 200px<br /><br />
<% DisplayProgressBarIEesque  75, 250 %> 75% @ 250px<br /><br />
<% DisplayProgressBarIEesque 100, 300 %> 100% @ 300px

Back the the Sample Output

Back to the Sample Index


Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers