Convert degrees Fahrenheid to / from Celcius

From: Wim Leys (wim.leys@lin.vlaanderen.be)
Date: Tue May 13 1997 - 10:47:30 PDT


Date: Tue, 13 May 1997 10:47:30 -0700
From: Wim Leys <wim.leys@lin.vlaanderen.be>
To: cp@opus.hpl.hp.com
Message-Id: <aabcdefg1887$foo@default>
Subject: Convert degrees Fahrenheid to / from Celcius

Hi,

I am putting my first steps om the JavaScript road. Since I always found
it confusing to read about temeratures expressed in degrees Fahrenheid,
I wrote this little HTML-JavaScript-program to do the conversion from
and to degrees Celsius.

You need a browser that supports JavaScript to use it (Netscape 3.0,
Internet Explorer, ...). Copy it from and including <HTML> up to and
including </HTML>, paste it into an empty ASCII-file and give it a name
like F2C.HTML or F2C.HTM, then access it using your browser.

<HTML>
<HEAD>
<TITLE>Convert Fahrenheid to/from Celcius</TITLE>

<SCRIPT LANGUAGE="JavaScript">
        function DegreesF2C(F, C) {
                C.value = (parseInt(F,10) - 32) / 1.8;
        }

        function DegreesC2F(C, F) {
                F.value = (parseInt(C, 10) * 1.8) + 32;
        }
</SCRIPT>
</HEAD>

<BODY>
<H1>Convert &#176; Fahrenheid to and from &#176; Celcius.</H1>
<FORM>
        <TABLE>
                <TH ALIGN="left">Enter the temperature in &#176;
Fahrenheid : <TD>
                <INPUT TYPE="text" NAME="F" SIZE=5><TD>
                &#176; F<TD>
                <INPUT TYPE="button" VALUE="Convert F to C"
ONCLICK="DegreesF2C(this.form.F.value, this.form.F2C)"><TD>
                <INPUT TYPE="text" NAME="F2C" SIZE=5><TD>
                &#176; C<TR>

                <TH ALIGN="left">Enter the temperature in &#176; Celcius
: <TD>
                <INPUT TYPE="text" NAME="C" SIZE=5><TD>
                &#176; C<TD>
                <INPUT TYPE="button" VALUE="Convert C to F"
ONCLICK="DegreesC2F(this.form.C.value, this.form.C2F)"><TD>
                <INPUT TYPE="text" NAME="C2F" SIZE=5><TD>
                &#176; F<TR>

                <TH> <TR>

                <TH><TD>
                <INPUT TYPE="reset" VALUE="Clear"><TD>
                <TR>
        </TABLE>

</FORM>
</BODY>
</HTML>

Kind regards
Wim



This archive was generated by hypermail 2b30 : Tue Jan 02 2001 - 17:31:03 PST