View Single Post
01-15-2011, 04:50 AM
#2
Morning is offline Morning
Status: Junior Member
Join date: Nov 2010
Location: Alabama, USA
Expertise: web design, writing, proofread
Software: HomeSite, Paint Shop Pro
 
Posts: 50
iTrader: 0 / 0%
 

Morning is an unknown quantity at this point

  Old

I found one where they did what you're wanting to do. They offer a bit of code to show how:

Code:
<div onClick="javascript:ajax_changeUnits();" style="cursor: pointer"><b>
      <span id="uomM" style="color: gray;">METRIC</span> |
      <span id="uomE" style="color: blue;">IMPERIAL</span></b>
 </div>

You need to enclose your static fields in "ajax-dashboard.php", i.e. fields that don't have an "ajaxtag" which
you want to have converted during UOM switching, with one of the following corresponding <span> classes:
----------------------------------------------------------
<span class="convTemp">82.7&deg;F</span> ...for temp
<span class="convWind"> 2.7 mph</span> ...for wind
<span class="convBaro">30.30 inHg</span> ...for baro
<span class="convRain"> 1.04 in</span> ...for rain
<span class="convSnow"> 12.4 in</span> ...for snow
<span class="convAlti"> 2793 ft</span> ...for altitude
<span class="convDist"> 15 miles</span> ...for distance
<span class="convDate">20-10-2009</span> ...for dates
<span class="convTime"> 15:32:27</span> ...for times
----------------------------------------------------------
NOTE: the value in the span must include the units-of-measure for them to be converted.
If you need CSS styling on the same field then you can specify it in the same class tag like this for instance:
<span class="convRain rainStyle">171.4 mm</span>
It seems like you ought to be able to adapt this for what you're trying to do. Hope it helps!

Reply With Quote