ボタンをクリックすると、私のコードはすべてのテーブルの色のみを変更します。各セルの間にスペースがあることに注意してください。テーブル自体ではなく、テーブル内のすべてのセルの色を変更する必要があることがわかりました。どんな提案でも、私はJSとCSSが初めてです。
<script type="text/javascript">
function color(){
document.getElementById('mytable').style.backgroundColor ="blue";
}
</script>