<%
Dim Sl_gauge
Set Sl_gauge = new Slgauge
Sl_gauge. bgcolor = "#FFFFFF"
Sl_gauge. Fgcolor = "#990000"
Sl_gauge. Width = 78
Sl_gauge. Height = 5
Sl_gauge. Minval = 0
Sl_gauge. Maxval = 100
Sl_gauge. Curval = Itestscore ' 87% in our example
%>
<!--Display the gauge-->
<table cellpadding=0 cellspacing=2>
<tr>
<td>0</td>
<td><% = Sl_gauge. Renderhtml%></td>
<td>100%</td>
</tr>
</table>
<%
' Handy class for displaying a horizontal percentage gauge.
%>
<%
Class Slgauge
' Colors.
public bgcolor
Public Fgcolor
' Dimensions.
Public Width
Public Height
' Values.
Public Minval
Public Maxval
Public Curval
' Render this into HTML as a table.
function renderhtml
' Normalize the properties.
If Minval > Maxval Then
Dim Temp_val
Temp_val = Minval
Minval = Maxval
Maxval = Temp_val
End If
If Curval < minval Then
Curval = Minval
ElseIf curval > Maxval Then
Curval = Maxval
End If
' Figure out of the percentage that's curval is
' Within Minval and maxval.
Dim Percentage_val
Percentage_val = (curval-minval)/(Maxval-minval)
' Compute the second widths.
Dim Fg_width
Fg_width = Round (width * percentage_val)
Dim Bg_width
Bg_width = Width-fg_width
renderhtml = "<table cellspacing=0 cellpadding=0 width=" & _
Width & "height=" & Height & ">" _
& "<tr>"
If fg_width > 0 Then
Renderhtml = Renderhtml _
& "<td width=" & Fg_width & "Height=" & _
Height & "Bgcolor=" & Fgcolor & _
"><img src=/demos/images/" & _
"1_pix_trans.gif></td>"
End If
If bg_width > 0 Then
Renderhtml = Renderhtml _
& "<td width=" & Bg_width & "Height=" & _
Height & "Bgcolor=&quo