我这里有这个代码.我需要放置用户输入的值(比如整数10),在其上计算操作并将答案输入到我的表定义的行中.
我无法在4列中复制相同的值.我该如何更改代码?
<html>
<table>
<tr>
<td class="demo"></td>
<td class="demo"></td>
<td class="demo"></td>
<td class="demo"></td>
</tr>
</table>
Enter Input:<input type="text" name="test"/>
<script>
function testfunc()
{
var tt=document.getElementsByName("test")[0].value;
document.getElementsByClassName("demo").innerHTML = tt*20;
}
</script>
<button onclick="testfunc()">TEST</button>
</html>
Run Code Online (Sandbox Code Playgroud)