<script> var tableElements = document.getElementById("myTableData"); for(var j = 0; j < tableElements.rows.length; j++){ var row = tableElements.rows.item(j); row.style.backgroundColor = "yellow"; } </script>