> Designing & Implementation: Can someone assist me on this javascript problem?

Designing & Implementation: Can someone assist me on this javascript problem?

Posted at: 2014-12-18 
Lots of stuff wrong in your HTML. The form tag doesn't belong in the table tag. It's missing a closing after the age input and there is a closing button tag where there is no opening button. There is also a semicolon outside the quotes for the click handler.

It's not a rule but a good practice to always use brackets in your if statements, even if they are only one line. In the case of your code, they're actually required or you will see a syntax error in the console. Your code is also missing a closing curly brace. Here's how that should look.

if (a < 18) {

????document.write("Child");

} else if (a < 35) {

????document.write("Young");

} else if (a < 50) {

????document.write("Adult");

} else {

????document.write("Old");

}

Anywho, here's the whole thing with the corrections.



????







How old







????


????????

????????

????????????

????????????

????????

????????


????????????????

????????????


????????????????

????????????


????






Problem: write a java script program in HTML which will accept entered ages from a user, if a user clicks on a display button a corresponding result will be displayed based on:

< 18 :Child,

< 35: Young,

< 50: Adult,

< 50: Old.

My soln so far:





How old






















the problem is when run the in a web-browser, it shows the 'text field & a display button', but when enter age and i click on the button, it doesn't display the desired output