%@ LANGUAGE=VBScript %>
Speed Conversion
<%
Function getFactor( strUnitCode )
Select Case strUnitCode
Case "A"
getFactor = 1
Case "B"
getFactor = 39.37 / 12
Case "C"
getFactor = 3600 / 1000
Case "D"
getFactor = 3600 / 5280 * 39.37 / 12
End Select
End Function
Function getUnitName( strUnitCode )
Select Case strUnitCode
Case "A"
getUnitName = "m/sec"
Case "B"
getUnitName = "ft/sec"
Case "C"
getUnitName = "km/hr"
Case "D"
getUnitName = "mi/hr"
End Select
End Function
Dim strValue
strValue = Request( "value" )
Dim dValue
If IsNumeric( strValue ) Then
dValue = CDbl( strValue )
Else
dValue = 0
End If
Dim strFrom
strFrom = Request( "from" )
Dim strTo
strTo = Request( "to" )
%>
Speed Conversion
<%= dValue %> <%= getUnitName( strFrom ) %> =
<%= dValue / getFactor( strFrom ) * getFactor( strTo ) %>
<%= getUnitName( strTo ) %>