javascript - Table to validate data inserted manualy and give a message at the end -


i'm trying create html table compare numbers intervals , according interval data situated display message @ end. data polluted soil sample results , result should tell me in class soil situated. have made table last cell doing want. repeat script give each result right of each cell in fact need answer @ end. can me build global variable table ?

here what have far. last cell doing want.
cells text there information purpose give general idea

i have 37 variables (analise results) have compare 3 intervals (fnade classe 1, 2 , 3). if 1 of variables found in interval should display me name of interval (ex: fnade classe 1), hierarchy being 3<2<1

here code part, maybe helps :

window.onload=function() {     document.getelementbyid("form1").onsubmit=function() {         var celula37 = parseint(this.celula37.value,10);         var text = "<b>votre terre peut etre reçue dans une instalation : </b>";         if (celula37 <= 399) text += "fnade classe 3";           else if (celula37 >= 400 && celula37 <= 1800) text += "fnade classe 2";           else if (celula37 >= 1801) text += "fnade classe 1";         else text = "svp inserez des donnes";         document.getelementbyid("soilmessage").innerhtml=text;           return false; // cancel submit     } } 

when working groups of elements it's easier use css class name of elements can treated array. helps style things using css instead of repeating inline style statements.

<input type="text" class="celldata" name="celula37" id="celula37" value="" /> 

then can this:

mydata = document.getelementsbyclassname('celldata') var celula37; for(var x = 0;x<mydata.length;x++) {     celula37 = parseint(mydata[x].value,10);     ... code ...     document.getelementbyid('celula'+x).innerhtml = text;     // note, arrays zero-based, may need tweak ids or 'x'   } 

mydata array of inputs.

then can style things using css:

<style> .celldata {   border:solid windowtext 1.0pt; }  td {   border:solid windowtext 1.0pt; } </style> 

bon chance!


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -