SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2011
    0 Post(s)
    0 Thread(s)

    Choose between Fahrenheit/Celsius

    I am including a weather forecast on my site. The code is from 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 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.


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

    <div style='width: 435px; height: 90px; background-image: url( ); background-repeat: no-repeat; background-color: #;' ><div id='NetweatherContainer' style='height: 75px;' ><script src='|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='|NL|NL008|AMSTERDAM|&metric=1' >Forecast</a>*|*<a style='color: #' href='' >Maps</a>*|*<a style='color: #' href='|NL|NL008|AMSTERDAM|' >Radar</a></div><img style='float: right; padding-right: 5px;' src='' /><div style='clear: both;' /></div></div>

  2. #2
    SitePoint Evangelist
    Join Date
    Jun 2007
    North Yorkshire, UK
    0 Post(s)
    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


Posting Permissions

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