SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jun 2011
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Choose between Fahrenheit/Celsius

    Hello,
    I am including a weather forecast on my site. The code is from accuweather.com and they provide the code in Fahrenheit or in Celsius. I would like to have an option for the visitor to choose whether the see the forecast in Fahrenheit or in Celsius. I started with JavaScript, but it did not work out since the code accuweather.com is providing is not allowed to be inside JavaScript neither inside php code. How could I create a radio button or a link so that it would work?

    One option is to copy the whole web page and to have the other one with Fahrenheit forecast and the other one with Celsius forecast and link between them but it is not neat that way. There is hopefully a cool way to do it.

    Thanks.





    The accuweather.com forecast code for Amsterdam in Celsius is below (the Fahrenheit core is not included):

    <div style='width: 435px; height: 90px; background-image: url( http://vortex.accuweather.com/adcbin..._435x90_bg.jpg ); background-repeat: no-repeat; background-color: #;' ><div id='NetweatherContainer' style='height: 75px;' ><script src='http://netweather.accuweather.com/adcbin/netweather_v2/netweatherV2ex.asp?partner=netweather&tStyle=normal&logo=1&zipcode=EUR|NL|NL008|AMSTERDAM|&lang=eng&size=10&theme=clouds&metric=1&target=_self'></script></div><div style='text-align: center; font-family: arial, helvetica, verdana, sans-serif; font-size: 10px; line-height: 15px; color: #;' ><a style='color: #' href='http://www.accuweather.com/world-index-forecast.asp?partner=netweather&locCode=EUR|NL|NL008|AMSTERDAM|&metric=1' >Forecast</a>*|*<a style='color: #' href='http://www.accuweather.com/maps-satellite.asp' >Maps</a>*|*<a style='color: #' href='http://www.accuweather.com/index-radar.asp?partner=accuweather&zipcode=EUR|NL|NL008|AMSTERDAM|' >Radar</a></div><img style='float: right; padding-right: 5px;' src='http://vortex.accuweather.com/adc2004/common/images/misc/netweather_v2/adcwhite.png' /><div style='clear: both;' /></div></div>

  2. #2
    SitePoint Evangelist
    Join Date
    Jun 2007
    Location
    North Yorkshire, UK
    Posts
    483
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Isn't the clue &metric=1 in the code you posted the clue. Set it to zero for Fahenheit.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •