javascript - Create drop-down list from user input -


let me simplify question way. there 2 tables in document. 1st table requires input user. max length 8 characters. 2nd table readonly. contains selection 3 options. want this: user input in (1st table) cell1 = (2nd table) option1 in select element user input in (1st table) cell2 = (2nd table) option2 in select element user input in (1st table) cell3 = (2nd table) option3 in select element can't achieve this. errors?

<!doctype html> <html> <head> <title>thermo analysis</title> <style type="text/css"> body {font-family: arial, verdana, helvetica,sans-serif; margin-left: 50px;  max-width: 600px;} th {font-size: 14px; border: 1px; border-style: solid; border-colapse:    colapse; border-spacing: 0px;} td {font-size: 14px; border: 1px; border-style: solid; margin: 0px;  border-colapse: colapse; border-spacing: 0px;} input:focus {background-color: rgb(255,255,150);} </style> </head> <body> <table id="imp"> <tbody> <tr> <th>grade</th> </tr> <tr> <td><input type="text" maxlength="8" onkeyup="implist((this));" /></td> </tr> <tr> <td><input type="text" maxlength="8" onkeyup="implist((this));" /></td>  </tr>  <tr> <td><input type="text" maxlength="8" onkeyup="implist((this));" /></td>  </tr> </tbody> </table> <br><br> <table id="impdata"> <tbody> <tr> <th>system</th> <th>thermo-category</th> </tr> <tr> <td>thermo-kinetics</td> <td> <select>   <option input type="text"></option>   <option input type="text"></option>   <option input type="text"></option> </select> </td> </tr> </tbody> </table> </form> <script> function implist() { var table = document.getelementbyid("imp"); var valone = table.rows[1].cells[0].getelementsbytagname("input")[0].value; var valtwo= table.rows[2].cells[0].getelementsbytagname("input")[0].value; var valthree = table.rows[3].cells[0].getelementsbytagname("input") [0].value;  var optionone = valone.slice(0, 3); var optiontwo = "";     var optionthree = ""; var optiontwo = valtwo.slice(0, 3); if (optiontwo === optionone) {     optiontwo = optiontwo + "1";    } var optionthree = valthree.slice(0, 3); if (optionthree !== "" && optionthree === optionone) {     optionthree = optionthree + "2"; } else if (optionthree !== "" && optionthree === optiontwo) {     optionthree = optionthree + "1"; }  var tble = document.getelementbyid("impdata"); tble.rows[1].cells[1].selects[0].["option"][0].["input"][0].value =    optionone; tble.rows[1].cells[1].selects[0].["option"][1].["input"][0].value =    optiontwo; tble.rows[1].cells[1].selects[0].["option"][2].["input"][0].value =   optionthree; } </script> </body> </html> 


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -