dollar.fsp - Frink Server Pages highlighter

[Try dollar.fsp]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<HTML LANG="en">
 <HEAD>
  <TITLE>Historical Currency Conversions</TITLE>
  <META HTTP-EQUIV="Default-Style" CONTENT="APE Airy">
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> 
  <LINK REL="StyleSheet" HREF="/frinkdocs/apeairy.css" TYPE="text/css"
        TITLE="APE Airy"> 
  <LINK REL="Alternate StyleSheet" HREF="/frinkdocs/style.css" TYPE="text/css"
        TITLE="APE Classic">
  <LINK REL="Alternate StyleSheet" HREF="/frinkdocs/style2.css" TYPE="text/css"
        TITLE="Compact"> 
  <LINK REL="icon" HREF="/images/futureboyicon.png" TYPE="image/png">
  <META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0">
 </HEAD>

 <BODY>
  <H1>Historical Currency Conversions</H1>
  <% if ! quantity then quantity = "1"
     if ! fromYear then fromYear = "1940"
     currencies = [ "dollars", "cents", "pounds", "guineas", "sovereigns", "merk", "mark", "crowns", "florins", "shillings", "groats", "pence", "farthings"]
  %>
  <P>
   This form allows you to convert the historical buying power of American and
   British currencies into current dollars.
  </P>

  <P>
   Since this is <A HREF="/frinkdocs/">Frink</A>, the quantity can be entered
   as a number like "1000" or "10 million" or any mathematical expression.
  </P>
  
  <FORM METHOD="GET" ACTION="dollar.fsp">
   <INPUT TYPE="TEXT" NAME="quantity" SIZE=20 VALUE="$quantity"
          onFocus="if (this.value != '') select();">
   <SELECT NAME="currency">
    <% for [name] currencies
    {
         sel = (name == currency ? " SELECTED" : "")
         println["    <OPTION$sel>$name"]
    } %>
   </SELECT>
   in the year
   <INPUT TYPE="TEXT" NAME="fromYear" SIZE=4 VALUE="$fromYear"
          onFocus="if (this.value != '') select();">
   <INPUT TYPE="SUBMIT" VALUE="Calculate">
  </FORM>

  <HR>
  <DIV CLASS="back">
  <% if currency and quantity and fromYear
     {
       newval = eval["$quantity ${currency}_$fromYear / dollar"]
       if newval > 1 trillion
          s = formatFix[newval, "trillion", 3]
       else
          if newval > 1 billion
             s = formatFix[newval, "billion", 3]
          else
             if newval > 1 million
                s = formatFix[newval, "million", 3]
             else
                s = formatFix[newval, 1, 2]
  
       print["$quantity $currency in $fromYear had the same buying power as "]
       print["<B>$s</B> current dollars."]
     }
   %>
   </DIV>
  <HR>
  <P>
   <I><A HREF="mailto:eliasen@mindspring.com">Alan Eliasen</A></I> was born
   <%= round[now[] - #1969-08-19 04:54 PM Mountain#, minute] -> ["days", "hours", "minutes"] %> ago.
  </P>

  <P>
   Back to <A HREF="/frinkdocs/fspdocs.html">Frink Server Pages
    documentation.</A>
  </P>  
 </BODY>
</HTML>

[Try dollar.fsp]


Alan Eliasen was born 19945 days, 0 hours, 26 minutes ago.

Back to Frink Server Pages documentation.