This is a form.











This is NOT a form.







A copy of the JavaScript functions in the head element:

// sample-3-button-processing.js
// This sample shows processing of button types: button and submit

// Reset values onload of the body
function loaded()
  {
  var input_area = document.getElementById("change-input");
  input_area.value = "";
  var input_area2 = document.getElementById("change-input2");
  input_area2.value = "";
  }

// doubles the value in the input area passed as a parameter
function double(input_area)
  {
  var input_value = parseFloat(input_area.value);
  if ( isNaN(input_value ) )
    {
    input_area.value = 0;
    }
  else
    {
    input_area.value = 2 * input_value;
    }
  }

// button click handler for button-in-form
// identify the input area and call the double function
// NOTE: The function names button_in_form and buttonInForm would not work
function bif()
  {
  var input_area = document.getElementById("change-input");
  double(input_area);
  }

// button click handler for button-not-in-form
// identify the input area and call the double function
function button_not_in_form()
  {
  var input_area = document.getElementById("change-input2");
  double(input_area);
  }

// check the result, convert it to numeric if needed, 
// ask the use if they want it submitted, and submit or cancel submission
function submit1()
  {
  var input_area = document.getElementById("change-input");

  // make the input_value variable a number from the input_area.value
  var input_value = parseFloat(input_area.value);
  if ( isNaN(input_value ) )
    {
    input_value = 0;
    }

  var choice = confirm("Do you wish to submit?");
  // if being submited, put the numeric value in the input_area value
  if (choice)
    {
    input_area.value = input_value;
    }
  return choice;
  }