S jQuery asi takhle: Javascript:
var NEW_COLOR = 'lightblue';
var DEFAULT_COLOR = 'white';
$(function(){
$('.selector input').change(function(e){
e.preventDefault();
var tr = $(this).parent().parent();
$(tr).find('td').css('background', DEFAULT_COLOR);
var cell =
$(tr).find('td:nth-child('+$(this).val()+')');
while (cell.length > 0) {
$(cell).css('background', NEW_COLOR);
cell = $(cell).next();
}
});
});
HTML:
<table class="selector">
<tr>
<td><input type="number" value="2" min="1"></td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
</table>
Za funkčnost neručím, nezkoušel jsem.