java - Verify data from a HTML cell and display a message according to an interval -


basically i'm working on html form validate numbers (soil pollutants concentrations inserted manually) , give message in cell @ end, according on scale numbers situated

in case, concentration of copper in soil x=500 mg/kg. need verify number intervals limits soil pollution (400 < x < 1800= poluted) , display message like:

"your soil considered polluted"

because concentration on 400 mg/kg, example.

can give me idea on how this? need integrate webpage.

something this?

live demo

<!doctype html> <html> <head> <title>soil analysis</title> <script type="text/javascript"> window.onload=function() {   document.getelementbyid("form1").onsubmit=function() {     var copper = parseint(this.copper.value,10);     var text = "your soil ";     if (copper <= 400) text += "not polluted";       else if (copper < 1800) text += "considered polluted";       else text += "considered polluted";       document.getelementbyid("soilmessage").innerhtml=text;       return false; // cancel submit   } } </script> </head> <body>   <form id="form1">     <input type="text" name="copper" id="copper" value="" />     <input type="submit" value=" validate " />   </form>   <div id="soilmessage"></div> </body> </html> 

Comments