如何設置input
框的值?當我的代碼運行gng()
功能不起作用。我只看到input
框的值爲字符串"gng()"
。陣列中的功能不工作
<div id="yeni" style="position: absolute; top: 50px; left: 30px; width: 700px; height: 400px; "> </div>
<script>
var tbl = document.createElement('table');
var tr = [];
var td = [];
var rowcount = 5;
var columncount = 3;
var dataarray = [["1", "red", " <input value=\"gng(9,5)\">"],
["2", "white", " <input value=\"gng(3,5)\">"],
["3", "black", " <input value=\"gng(4,5)\">"],
["4", "green", " <input value=\"gng(1,5)\">"],
["5", "gray", " <input value=\"gng(2,5)\">"]]
for(s = 0; s < rowcount; s++) {
tr[s] = document.createElement('tr');
for(i = 0; i < columncount; i++) {
td[i] = document.createElement('td');
td[i].innerHTML = dataarray[s][i];
tr[s].appendChild(td[i]);
}
tbl.appendChild(tr[s]);
}
document.getElementById('yeni').appendChild(tbl);
function gng(a, b) {var c = a/b;return c;}
</script>
這是什麼'綁定',它是如何使用你的代碼?你使用框架的一些王?你能展示更完整的代碼嗎? –