javascript - How to call to a function, with a string -
javascript - How to call to a function, with a string - i creating string headlines of table, making checkbox each headline, , should hide col if unchecked , show if checked. function set checkbox in div. i calling function when page loaded (onload in body) this function: function getfirstrow(table) { var table = document.getelementbyid(table); var row = table.getelementsbytagname('tr')[0]; var cells = row.getelementsbytagname('th'); var str = ""; (var i=0; < cells.length; i++) { str += "<input type='checkbox' onclick='hideorshowcol('treestable', "+i+", this);' checked='checked' />" + cells[i].innerhtml + " "; } document.getelementbyid("hideandshow").innerhtml = str; } and hide/show function: function hideorshowcol(table, col, e) { alert(e.checked); var iftoshow = ""; if (e.checked) iftoshow = ...