Try using a input with the type set to number. This will automatically validate itself, without the need for any JS.
<td><input type="number" name="salary"></td>
Here's a JsFiddle: http://jsfiddle.net/8apDY/
Here's the pure Javascript solution: http://jsfiddle.net/8apDY/20/