Some Sampel of Code

Hi,
here i want to publish some Code-snippets that i use. Maybe it helps someone.

  1. Display UV-Index
<center><span style="font-size:45px"> The current UV-Index is:</span></center>
<br>
<br>
<center>
<span style="font-size:70px">
<script type="text/javascript">

var uvin;
uvin ='[uvIndex]';

switch (uvin) {
 case '1':
        document.write("<b><span style=color:#00c800>" + uvin + "</span> <b>");
        break;
case "2":
       document.write("<b><span style=color:#00c800>" + uvin + "</span> <b>");
      break;
case "3":
       document.write("<b><span style=color:#f8f800>" + uvin + "</span> <b>");
      break;
case "4":
       document.write("<b><span style=color:#f8f800>" + uvin + "</span> <b>");
      break;
case "5":
       document.write("<b><span style=color:#f8f800>" + uvin + "</span> <b>");
      break; 
case "6":
       document.write("<b><span style=color:#FFA500>" + uvin + "</span> <b>");
      break; 
 case "7":
       document.write("<b><span style=color:#FFA500>" + uvin + "</span> <b>");
      break; 
case "8":
       document.write("<b><span style=color:#ec0000>" + uvin + "</span> <b>");
      break; 
case "9":
       document.write("<b><span style=color:#ec0000>" + uvin + "</span> <b>");
      break; 
case "10":
       document.write("<b><span style=color:#ec0000>" + uvin + "</span> <b>");
      break; 
}
</script>
</span>
</center>
<br>
  1. Covert Windspeed from Km/h to Windforce
> <center><span style="font-size:45px"> Windspeed:</span></center>
> <br>
> <br>
> <center>
> <span style="font-size:70px">
> <script type="text/javascript">
> var windspeed;
> windspeed ='[windSpeed]';
> 
> if (windspeed <=1.85) {document.write("<b><span style=color:#ffffff>0</span> <b>")};
> if (windspeed >=1.85 && windspeed <=7.41) {document.write("<b><span style=color:#ECECFF>1</span> <b>")};
> if (windspeed >=7.41 && windspeed <=12.96) {document.write("<b><span style=color:#D9D9FF>2</span> <b>")};
> if (windspeed >=12.96 && windspeed <=20.37) {document.write("<b><span style=color:#C5C5FF>3</span> <b>")};
> if (windspeed >=20.37 && windspeed <=29.63) {document.write("<b><span style=color:#B0B0FF>4</span> <b>")};
> if (windspeed >=29.63 && windspeed <=40.74) {document.write("<b><span style=color:#9B9BFF>5</span> <b>")};
> if (windspeed >=40.74 && windspeed <=51.86) {document.write("<b><span style=color:#8383FF>6</span> <b>")};
> if (windspeed >=51.86 && windspeed <=62.97) {document.write("<b><span style=color:#6868FF>7</span> <b>")};
> if (windspeed >=62.97 && windspeed <=75.93) {document.write("<b><span style=color:#6868FF>8</span> <b>")};
> if (windspeed >=75.93 && windspeed <=88.90) {document.write("<b><span style=color:#0000FF>9</span> <b>")};
> if (windspeed >=88.90 && windspeed <=103.71) {document.write("<b><span style=color:#0000BB>10</span> <b>")};
> if (windspeed >=103.71 && windspeed <=118.53) {document.write("<b><span style=color:#000077>11</span> <b>")};
> if (windspeed >=118.53) {document.write("<b><span style=color:#000000>12</span> <b>")};
> </script>
> </span>
> </center>

Greetings Torsten

2 Likes
  1. Windspeed from m/s to Windforce from @peterspie
<script type="text/javascript">
var windspeed;
windspeed ='[windSpeed]';
if (windspeed <=0.02)                      {document.write("<b><span style=color:#ffffff>0 <b>")};
if (windspeed >=0.03  && windspeed <=1.5)  {document.write("<b>1 <b>")};
if (windspeed >=1.6   && windspeed <=3.3)  {document.write("<b>2 <b>")};
if (windspeed >=3.4   && windspeed <=5.4)  {document.write("<b>3 <b>")};
if (windspeed >=5.5   && windspeed <=7.9)  {document.write("<b>4 <b>")};
if (windspeed >=8.0   && windspeed <=10.7) {document.write("<b>5 <b>")};
if (windspeed >=10.8  && windspeed <=13.8) {document.write("<b>6 <b>")};
if (windspeed >=13.9  && windspeed <=17.1) {document.write("<b>7 <b>")};
if (windspeed >=17.2  && windspeed <=20.7) {document.write("<b>8 <b>")};
if (windspeed >=20.8  && windspeed <=24.4) {document.write("<b>9 <b>")};
if (windspeed >=24.5  && windspeed <=28.4) {document.write("<b>10 <b>")};
if (windspeed >=28.5  && windspeed <=32.6) {document.write("<b>11 <b>")};
if (windspeed >=32.7)                      {document.write("<b>12 <b>")};
</script>

Greetings Torsten