Author Topic: Comfort script  (Read 1486 times)

0 Members and 1 Guest are viewing this topic.

Offline dsscheibe

  • Senior Member
  • **
  • Posts: 98
    • Scott's Weather Station Cactus Wren, Phoenix, AZ
Comfort script
« on: July 14, 2009, 11:49:12 PM »
Some one else wrote this original script and under one the the VWS topics a while back some one asked how to changed the text color so this is how.  The forum suggested I post it under another topic since the last post in that one was over 90 days old or something like that.  I also have a script that reports how many days it's been since it rained someone wrote and posted on the old Ambient forum if anyone wants it.  It someone would like to take credit for  the scripts I'd like to put their name and contact in a comment in the scripts.


Changing the color of the text can be done a couple of ways.  You could use a

Code: [Select]
<font color="red">really hot</font>
Which is depreciated in current html coding practices.


  Or you can use a style sheet and a style selector, CSS or cascading style sheets is the recommended method and using font is depreciated in current code practices.  I have removed all the font tags from my websites and switched to an external style sheet.  Style sheets are really cool because you can change something in your style.css and if you have linked to it on ever page of your site it will change the element site wide with just changing one bit of code in one file.

First you need a file named something like style.css, you can call it anything you want as long as the extension is .css Upload it with your .htm files on your site.  I call mine for my weather page weatherstyle.css  You link it to your page using the code below, it has to be above the head tag at the top of your page which I included in the code, be sure you do not have two closing
Code: [Select]
</head> tags.

Code: [Select]
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
  <link rel="stylesheet" type="text/css" href="style.css" title="Default">
 </head>



Your style.css  needs to have this code in it for the existing script I'm posting below to work.  You can change the colors, font-size, and font-weight to suite your needs.  You can add what ever valid css commands to the style sheet you want, but this has to be in it for the comfort script below to set the colors for the text.


Code: [Select]
/* selectors for font sizes and color comfort level script IE <span class="DHOT">Dangerously Hot</span>  */

.ECOLD {
Color: white;
font-size: 16px;
font-weight: 600;
}


.UCOLD {
Color: #fffff3;
font-size: 16px;
font-weight: 600;
}

.COLD {
Color: #F8F8FF;
font-size: 16px;
font-weight: 600;
}

.COOL {
Color: Aqua;
font-size: 16px;
font-weight: 600;
}


.COM {
Color: Blue;
font-size: 16px;
font-weight: 600;
}


.WARM {
Color: #FFCC00;
font-size: 16px;
font-weight: 600;
}


.HOT {
Color: #FF9900;
font-size: 16px;
font-weight: 600;
}


.UHOT {
Color: #FF9933;
font-size: 18px;
font-weight: 600;
}


.EHOT {
Color: #FF3333;
font-size: 18px;
font-weight: 600;
}


.DHOT {
Color: Red;
font-size: 16px;
font-weight: 600;
}



I've modified the original code a bit to suite my need here in Phoenix and added the color changes.  you can see it working on my website at [urlhttp://members.cox.net/dsscheibe/vws/index.html[/url  you can see my style sheet for the website  here, the selectors for the script are at the bottom of the sheet.  [urlhttp://members.cox.net/dsscheibe/vws/weatherstyle.css[/url]

Code: [Select]

<!--     ^vst137^ ^uni137^  -->
 <script language="JavaScript" type="text/JavaScript">
e = Number(^vva165^);
var thwavg = Math.round(e);
</SCRIPT>
 <script language="JavaScript" type="text/JavaScript">
if (thwavg < 1) document.write(" class=ECOLD>Extremely Cold</span>");
else if (thwavg < 20) document.write("<span class=UCOLD>Uncomfortably Cold</span>");
else if (thwavg < 40) document.write("<span class=COLD>Cold</span>");
else if (thwavg < 60) document.write("<span class=COOL>Cool</span>");
else if (thwavg < 80) document.write("<span class=COM>Comfortable</span>");
else if (thwavg < 90) document.write("<span class=WARM>Warm</span>");
else if (thwavg < 98) document.write("<span class=HOT>Hot</span>");
else if (thwavg < 105) document.write("<span class=UHOT>Uncomfortably Hot</span>");
else if (thwavg < 108) document.write("<span class=EHOT>Extremely Hot</span>");
else document.write("<span class=DHOT>Dangerously Hot</span>");
</script>
<noscript>
^vst137^ ^uni137^
</noscript>


Scott
Davis Pro2 Plus daytime aspirated, wired
Weather Display


 

anything