kolya200598,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<table>
<tr>
<td id = "num1"><p class = "text">2</p></td>
<td id = "num2"><p class = "text">0</p></td>
<td id = "num3"><p class = "text">2</p></td>
<td id = "num4"><p class = "text">-2</p></td>
</tr>
</table>
<script>
var p = document.querySelectorAll('td p');
for (var i=0; i<p.length; i++) {
var num = +p[i].textContent;
if(num < 0 ) p[i].parentNode.style.backgroundColor = "#FFFF00";
// if(num ....)
}
</script>
</body>
</html>