A BBCode Tag to Display Temperatures in Celsius and Fahrenheit

Due to dramatic weather conditions in some parts of the U.S. at this time, the temperature often comes up in message-board conversations.  As some participants are used to referring to Celsius measurements and others are used to referring to Fahrenheit measurements, I thought it would be nice to have BBCode tag that automatically converted from one to the other, displaying both.

Please use the code in the .zip file available for download here:




<script type="text/javascript">if( ("{SIMPLETEXT}".substring(0,1)=="C")||("{SIMPLETEXT}".substring(0,1)=="c")){document.write("{TEXT}&deg; C / " +(({TEXT}*1.8) +32).toFixed(2) +"&deg; F " );}else {document.write("" +  (({TEXT}-32)/1.8).toFixed(2) + "&deg; C  / {TEXT}&deg F");}</script>

This tag displays temperatures in Celsius and Fahrenheit.

The above tag is licensed under the MIT/X11 license.  See http://www.mailsend-online.com/license2015.php



About Jim Lawless

I've been programming computers for about 36 years ... 30 of that professionally. I've been a teacher, I've worked as a consultant, and have written articles here and there for publications like Dr. Dobbs Journal, The C/C++ Users Journal, Nuts and Volts, and others.
This entry was posted in Computers, Programming and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s