Want to make a table with 1 column with 3 rows. The user enters the number 10 in the 1st row and either a 10 or 9 in the 2nd row and the result displayed in the 3rd row should say either ‘ODD’ or ‘EVEN’.
I don’t want to declare the variable in the script, rather let the user enter the variable. The following is what I have done so far,when I run the script by itself, it works fine. I just don’t want a submit button showing, I want the program
to display ODD or EVEN in the last textField.
Any help or direction is very appreciated, I’m new to javascript…Correction, VERY NEW !!
You’ll want to run that calculation after both fields have been filled in. The easiest way to do this is to place the script at the end of the body, so that it can easily connect the script to the elements on the page.
When you’ve run the calculation, you’ll want to run the calculation again if the first or second field changes after being filled in. You can put the scripting code in a function called calculate, and assign to the first two fields an onchange event that does the calculation.
But it still doesn’t work. What am I missing?
What I want is to have the user input 10 and 9 and then the program display the word Odd.
Or have the user input 10 and 10 and display the word Even.
Please be patient, if I did something real stupid. I’m very very new to all this…Thanks
example of the table result desired:
10
10
Even
or
10
9
Odd
This is the html: (I’m about to style the table with css)
Well first of all, the onchange stuff should not be in the calculate function.
Secondly, there shouldn’t be two calculate functions. There should only be one instead.