title: How can I input data to Javascript for client-side processing?
body: <p>I'm relatively new to JavaScript and I am working on a new application. Based on the results of four drop-down selections, I would like to calculate and display a text box announcing the result. The code below allows me to make my selections on the html form and press the "submit" button, but no results are returned. </p>
  
  <p>I'm having a hard time debugging because I don't understand how to get periodic output on screen (document.write doesn't seem to work) to interpret program flow. I'm not even sure if the js is running...do I somehow need to call my js from within the HTML? Do I need to store my js in an external file and call that external file?</p>
  
  <p>Thanks!</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;SCRIPT type="text\Javascript" EVENT="onclick"&gt;
      var valueCS ;
      var valueV ;
      var valueVCS ;
      var valueStorm ;
      var finalValue = valueCS + valueV + valueVCS + valueStorm;
      var startOutage ;
      var outageEnd ;
  
      document.write="total is "+finalValue;
      if(finalValue==0000) {startOutage="28"; outageEnd="1";} else
        (finalValue==0001) {startOutage="27"; outageEnd="1";} else
        (finalValue==1110) {startOutage="22"; outageEnd="4";} else
        (finalValue==1111) {startOutage="24"; outageEnd="4";} else
        document.write("Invalid entries")
      document.write("Start Outage: "+startOutage&lt;br&gt;"Outage End: "+outageEnd)
      &lt;/SCRIPT&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form id = "outageSelector" method="post contServer=1000&amp;vistaServer=100&amp;vistaCSServer=10&amp;storm=1&amp;submitServerStatus=View+Outage+Groups"&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;&lt;h1&gt;Please choose the status of each system&lt;/h1&gt;&lt;/legend&gt;
          &lt;label&gt;Is the contact server up?&lt;/label&gt;
          &lt;select id="contServer" name="contServer"&gt;
              &lt;option valueCS=1000&gt;Up&lt;/option&gt;
              &lt;option valueCS=0&gt;Down&lt;/option&gt;
          &lt;/select&gt;&lt;br&gt;
          &lt;label&gt;Is the Vista server up?&lt;/label&gt;
          &lt;select id="vistaServer" name="vistaServer"&gt;
              &lt;option valueV=100&gt;Up&lt;/option&gt;
              &lt;option valueV=0&gt;Down&lt;/option&gt;
          &lt;/select&gt;&lt;br&gt;
          &lt;label&gt;Is VistaCS up?&lt;/label&gt;
          &lt;select id="vistaCSServer" name="vistaCSServer"&gt;
              &lt;option valueVCS=10&gt;Up&lt;/option&gt;
              &lt;option valueVCS=0&gt;Down&lt;/option&gt;
          &lt;/select&gt;&lt;br&gt;
          &lt;label&gt;Is the outage due to a storm?&lt;/label&gt;
          &lt;select id="storm" name="storm"&gt;
              &lt;option valueStorm=1&gt;Yes&lt;/option&gt;
              &lt;option valueStorm=0&gt;No&lt;/option&gt;
          &lt;/select&gt;&lt;br&gt;
          &lt;input type="submit" name="submitServerStatus" value="View Outage Groups" /&gt;
      &lt;/fieldset&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>