Results 1 to 3 of 3

Thread: Heat Index Project

  1. #1
    Join Date
    Jul 2010
    Posts
    14
    Thanks
    2
    Thanked 1 Time in 1 Post

    Question Heat Index Project

    In need of some help. I'm working on a project, and can't figure out, how to make a vb/java script work correctly.

    The image below is what I'm trying to create. At this point I'm doing it manaully. Someone suggested that I let a script do it for me automatically, which I am trying to do.



    I no good with coding, but I tried.

    Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Heat Index</title>
    <script type="text/javascript"> 
    function (HeatIndex) {
       var hi=%[wind_chill]deg_f%
    
             hi = %[wind_chill]deg_f%;
          }
       }
       displayFlag(hi);
    }
     
    function displayFlag(hi) {
       var flagDIV = document.getElementById("flag");
       var infoDIV = document.getElementById("info");
       var text = 'Current Heat Index: ' + hi + '<br />';
     
       if (hi >= 130) {
          flagDIV.innerHTML = '<img src="./images/flag_blk_extreme_danger.png" alt="Heat Index is Extreme Danger">';
          text += '<b>Extreme Danger</b>';
       } else if (hi >= 105) {
          flagDIV.innerHTML = '<img src="./images/flag_red_danger.png" alt="Heat Index is Danger">';
          text += '<b>Danger</b>';
       } else if (hi >= 90) {
          flagDIV.innerHTML = '<img src="./images/flag_ylw_extreme_caution.png" alt="Heat Index is Extreme Caution">';
          text += '<b>Extreme Caution</b>';
       } else if (hi >= 80) {
          flagDIV.innerHTML = '<img src="./images/flag_grn_caution.png" alt="Heat Index is Caution">';
          text += '<b>Caution</b>';
       } else {
          flagDIV.innerHTML = '<img src="./images/flag_default.png" alt="Heat Index is Okay">';
          text += '<b>Okay</b>';
       }
       infoDIV.innerHTML = text + infoDIV.innerHTML;
    }
    </script> 
    </head> 
     
    <body bgcolor="#ffffff" onload="HeatIndex"> 
     
    <div id="flag" style="float:left;">
     
    </div> 
     
    <div id="info"> 
    <p><a href="" onclick="window.open('./heat_stress.html','heat_stress','width=650,height=550')">Flag Definitions</a></p> 
    </div> 
    
    </body>
    
    </html>
    If anyone can help me, please do. I've very limited in my knowledge of scripting, and would greatly appreciate the help. I know there has to be an easy way to do this, but at the moment I'm having a brain cramp trying to figure it out.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Try:
    Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Heat Index</title>
    <script type="text/javascript"> 
    window.onload = function(){
       displayFlag(%[wind_chill]deg_f%);
    };
     
    function displayFlag(hi) {
       var flagDIV = document.getElementById("flag");
       var infoDIV = document.getElementById("info");
       var text = 'Current Heat Index: ' + hi + '<br />';
     
       if (hi >= 130) {
          flagDIV.innerHTML = '<img src="./images/flag_blk_extreme_danger.png" alt="Heat Index is Extreme Danger">';
          text += '<b>Extreme Danger</b>';
       } else if (hi >= 105) {
          flagDIV.innerHTML = '<img src="./images/flag_red_danger.png" alt="Heat Index is Danger">';
          text += '<b>Danger</b>';
       } else if (hi >= 90) {
          flagDIV.innerHTML = '<img src="./images/flag_ylw_extreme_caution.png" alt="Heat Index is Extreme Caution">';
          text += '<b>Extreme Caution</b>';
       } else if (hi >= 80) {
          flagDIV.innerHTML = '<img src="./images/flag_grn_caution.png" alt="Heat Index is Caution">';
          text += '<b>Caution</b>';
       } else {
          flagDIV.innerHTML = '<img src="./images/flag_default.png" alt="Heat Index is Okay">';
          text += '<b>Okay</b>';
       }
       infoDIV.innerHTML = text + infoDIV.innerHTML;
    }
    </script> 
    </head> 
     
    <body bgcolor="#ffffff"> 
     
    <div id="flag" style="float:left;">
     
    </div> 
     
    <div id="info"> 
    <p><a href="" onclick="window.open('./heat_stress.html','heat_stress','width=650,height=550')">Flag Definitions</a></p> 
    </div> 
    
    </body>
    
    </html>
    Jeremy | jfein.net

  3. The Following User Says Thank You to Nile For This Useful Post:

    Gulfbreeze (08-23-2010)

  4. #3
    Join Date
    Jul 2010
    Posts
    14
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default

    Nile,
    I forgot to Thank you for the help, it is Great Appreciated...You're a life saver!

    GulfBreeze

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
  •