var items = [
{ name: 'qqq', key: 7 },
{ name: 'www', key: 5 },
{ name: 'eee', key: 2 },
{ name: 'rrr', key: 1 },
{ name: 'ttt', key: 2 },
{ name: 'yyy', key: 4 }
];
items.sort(function (a, b) {
if (a.key > b.key) {
return 1;
}
if (a.key < b.key) {
return -1;
}
return 0;
});
$(document).ready(function(){
var color;
$('#colors div').click(function(){
color = $(this).attr('class');
});
$('table').on('click', 'td', function(){
$(this).toggleClass(color);
});
});
<form action='SaveFile'
target="fileIframe"
encType="multipart/form-data"
method="post"
role="document"
id="file_upload_form">
<iframe name="fileIframe"
tabIndex="-1"
id="fileIframe">
</iframe>
<input id="FileInput"
name="upload"
type="file"
title="Выберите файл"
onChange="document.getElementById('file_upload_form').submit()" />
</form>