-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.htm
88 lines (75 loc) · 2.69 KB
/
index.htm
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<head>
<title>Viki Data</title>
<link href="/Style.css" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="/img/favicon.png">
</head>
<link href="/gstyle.css" rel="stylesheet">
<div class="container">
<nav id="nav">
<ul>
<li><a href="#">+You</a>
</li>
<li><a href="#">Search</a>
</li>
<li><a href="#">Images</a>
</li>
<li><a href="#">Maps</a>
</li>
<li><a href="#">Play</a>
</li>
<li><a href="#">YouTube</a>
</li>
<li><a href="#">News</a>
</li>
<li><a href="#">Gmail</a>
</li>
<li><a href="#">Drive</a>
</li>
<li><a href="#">Calendar</a>
</li>
<li><a href="#">More</a>
</li>
</ul>
</nav>
<div id="sign">SIGN IN</div>
<div class="google">
<a href="#" id="google_logo"><img src="/img/image3.jpg" alt=" photo google-logo_zpspkcztsjo.png"/ title="Viki"></a>
</div>
<script type="text/javascript">
function Upload() {
var fileUpload = document.getElementById("fileUpload");
var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.csv|.txt)$/;
if (regex.test(fileUpload.value.toLowerCase())) {
if (typeof (FileReader) != "undefined") {
var reader = new FileReader();
reader.onload = function (e) {
var table = document.createElement("table");
var rows = e.target.result.split("\n");
for (var i = 0; i < rows.length; i++) {
var cells = rows[i].split(",");
if (cells.length > 1) {
var row = table.insertRow(-1);
for (var j = 0; j < cells.length; j++) {
var cell = row.insertCell(-1);
cell.innerHTML = cells[j];
}
}
}
var dvCSV = document.getElementById("dvCSV");
dvCSV.innerHTML = "";
dvCSV.appendChild(table);
}
reader.readAsText(fileUpload.files[0]);
} else {
alert("This browser does not support HTML5.");
}
} else {
alert("Please upload a valid CSV file.");
}
}
</script>
<input type="file" id="fileUpload" />
<input type="button" id="upload" value="Upload" onclick="Upload()" />
<hr />
<div id="dvCSV">
</div>