Online Prediction Tool Example

Below is a simple price prediction tool where predicted price is:

$4,000 x Floor area + $100,000 x Town A + $200,000 x Town B

The prediction tool above is built using HTML. The code is available here.

  • Download the html file

  • Open the html file with web browser (e.g., chrome) to view

  • Open the html file with text editor (e.g., notepad) to edit the code

Some quick comments on the code:

  • <select> creates drop-down list which we use to get the town. We name it twn so that we can retrieve its value subsequently.

  • <input> creates a textbox which we use to get the floor area. We name it fa so that we can retrieve its value subsequently.

  • <button> create a button that will execute the function funPredict, which declares two variables (price and town) used in computing the predicted price based on the formula above.

  • <script> allows us to embed JavaScript (e.g., the function funPredict) within our code.

This page was created using Google Sites.