Creating Javascript that outputs various results depending on comparisons

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

Creating Javascript that outputs various results depending on comparisons

So i am new to Javascript and have been self-teaching through W3Schools. I'm having difficulty working out how I can do the following. I'm currently using a spreadsheet with various If statements to figure the scores. If somebody can help by giving an example or pointing me in the direction of similar script I'd be grateful.

Below is an example of the HTML i currently have. I need to check if "Homea" and "Awaya" in the form match "Homea1" and "Awaya1" in the table respectively. If they do, then the output would be 3 and that would get placed in "Scorea1", this would repeat down for the rest of the code. There is a further condition if they don't match then you need to figure out that if "Homea" is larger than "Awaya" and "Homea1" is larger than "Awaya1" then 1 would be the output to "Scorea1". 1 would be the output also, if you replace the larger than to equal to and smaller than.

I know this sounds complicated so I'll explain the reasons behind this and how it sounds in practice.

A user will have their predictions of a football match (Soccer for Americans) in the table. Once the results are known they can enter them in the form and hit a button to calculate results. If their prediction matches the result they get 3 points, If their prediction guesses the correct outcome, (i.e. Home win, draw, Away win) then they get 1 point.