function Table info var people info split var table tr th ФИО th th e-

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function Table(info) {
var people = info.split('\r\n\r\n');
var table = '<tr><th>ФИО</th><th>e-mail</th><th>Сайт</th><th>Дата регистрации</th></tr>'
for (var i in people) {
var row = people[i].split('\r\n');
var cols = '';
for (var j in row) {
if (j === '2') {
cols += '<td> <a href = \'' + row[j] + '\'>' + row[j] + '</a></td>';
}
else {
cols += '<td>' + row[j] + '</td>';
}
}
table += '<tr>' + cols + '</tr>'
}
return '<h1 align = \'center\'>Информация</h1><table border = \'1px\' width = \'50%\' align = \'center\'>' + table + '</table>'
}
function ReadFile(file) {
if (window.File && window.FileReader && window.FileList && window.Blob) {
var fr = new FileReader();
fr.readAsText(file.files[0]);
fr.onload = function (e) {
document.getElementById('table').innerHTML = Table(e.target.result);
};
}
}