title: Using Javascript to compare two input numbers in HTML?
body: <p>I am using Notepad++ to create a simple web page where a user types in two numbers into a text box, and then presses a button. When they press the button something comes up that tells them whether the first or second number is greater. I have the following code but cant get anything to come up.  Does anyone know whats wrong?    </p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="content-type" content="text/html;charset=utf-8" /&gt;
     &lt;title&gt;Assignment 10 Form&lt;/title&gt;
  
      &lt;script type="text/javascript"&gt;
  
          function greaterNum(){
          var value1;
          var value2;
          value1 = document.First_num.value;
          value2 = document.last_num.value;
          if (value1 &gt; value2){
          alert('Value 1 is greater than value 2');
          document.body.style.background = "orange";
          }
  
      }
  
  
  &lt;/script&gt; 
  
  
  &lt;style type="text/css"&gt;
    body{background-color: #40FF00;
      margin-left: auto;
      margin-right: auto;
      width: 60%;
      }
  
  #container{
      border: 2px solid yellow;
      padding: 20px;
      }
  
  &lt;/style&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;h1&gt;Assignment 10&lt;/h1&gt;
  
  &lt;div id="container"&gt;
      &lt;div class="Num"&gt;
      &lt;form&gt;
  &lt;label class="label1"&gt;Enter Value 1:&lt;/label&gt;
  &lt;input type="text" name="First_num" value=" " /&gt;
  &lt;label class="label1"&gt;Enter Value 2:&lt;/label&gt;
  &lt;input type="text" name="last_num" value=" " /&gt;
  &lt;br/&gt;
  &lt;input type="button" value=" Which number is greater? " onclick="greaterNum();" /&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>