taobin_project/webs/index.html

79 lines
1.9 KiB
HTML
Raw Normal View History

2024-03-24 14:37:28 +07:00
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
2024-04-01 13:06:42 +07:00
<link rel="stylesheet" type="text/css" href="/css/minimal2.css">
2024-03-29 00:19:31 +07:00
2024-03-24 14:37:28 +07:00
</head>
2024-03-27 15:52:58 +07:00
<body>
<div id="begin"> begin </div>
</body>
2024-03-24 14:37:28 +07:00
<script>
function readFile(filePath) {
var result = null;
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", filePath, false);
xmlhttp.send();
if (xmlhttp.status==200) {
result = xmlhttp.responseText;
}
xmlhttp.abort();
return result;
}
2024-03-29 00:19:31 +07:00
function show_table_one_row( str_req){
var all_out = ""
var str1 = readFile("?"+str_req+"&concat");
console.log("["+ str1+"]")
const sp1 = str1.split("|");
2024-04-04 22:33:13 +07:00
if( sp1.length > 0){
all_out += "<H2>" + sp1[0] + "</H2>"
const sp2 = sp1[1].split(",");
2024-03-29 00:19:31 +07:00
2024-04-04 22:33:13 +07:00
all_out += "<table>";
all_out += "<tr>";
for (let i = 0; i < sp2.length; i++) {
const sp3 = sp2[i].split("=");
if( sp3.length == 2){
all_out += "<th>" + sp3[0] + "</th>"
}
2024-03-29 00:19:31 +07:00
}
2024-04-04 22:33:13 +07:00
all_out += "</tr>";
all_out += "<tr>";
for (let i = 0; i < sp2.length; i++) {
const sp3 = sp2[i].split("=");
if( sp3.length == 2){
all_out += "<td>" + sp3[1] + "</td>"
}
2024-03-29 00:19:31 +07:00
}
2024-04-04 22:33:13 +07:00
all_out += "</tr>";
all_out += "</table>";
2024-03-29 00:19:31 +07:00
}
return all_out;
}
2024-03-27 15:52:58 +07:00
function RereshAll(){
2024-03-29 00:19:31 +07:00
var all_out = ""
all_out += show_table_one_row("machine")
//console.log("Test readFile " + str_out)
all_out += show_table_one_row("order-position")
2024-04-04 22:33:13 +07:00
all_out += show_table_one_row("stock")
2024-03-29 00:19:31 +07:00
document.getElementById("begin").innerHTML = all_out;
2024-03-27 15:52:58 +07:00
}
setInterval( RereshAll, 1000);
2024-03-24 14:37:28 +07:00
</script>
</html>