javascript - Fetching values from user entered data -


i have made dynamic addition of rows containing text fields , drop downs . want fetch values user has entered in text input field , drop down , have display in table format.

code fetching values

function fetch(){    var myname = document.getelementbyid("name");     var type = document.getelementbyid("type");     var table = document.getelementbyid("mytabledata");     var rowcount = table.rows.length;     var row = table.insertrow(rowcount);     row.insertcell(0).innerhtml=myname.value;     row.insertcell(1).innerhtml= type.value;     row.insertcell(2).innerhtml= '<input type="button" value = "delete" onclick="javacsript:deleterow(this)">'; } 

by above line of codes trying fetch values enterd user in dynamically added rows , below code add rows dynamically

function addrow(tableid) {      var table = document.getelementbyid(tableid);      var rowcount = table.rows.length;     var row = table.insertrow(rowcount);      var colcount = table.rows[0].cells.length;      for(var i=0; i<colcount; i++) {          var newcell = row.insertcell(i);          newcell.innerhtml = table.rows[0].cells[i].innerhtml;         //alert(newcell.childnodes);         switch(newcell.childnodes[0].type) {             case "text":                     newcell.childnodes[0].value = "";                     break;            /*  case "checkbox":                     newcell.childnodes[0].checked = false;                     break; */             case "select-one":                     newcell.childnodes[0].selectedindex = 0;                     break;         }     } } 

but code trying fetch values not working. , want how values added rows using index[i] kind of property if there in document.getelementbyid method.please me out


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -