Update index.html
Browse files- index.html +53 -17
index.html
CHANGED
@@ -1,19 +1,55 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>选择对话框页面</title>
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
|
10 |
+
<label for="dialogueSelector">选择对话框:</label>
|
11 |
+
<select id="dialogueSelector" onchange="loadDialogue()"></select>
|
12 |
+
|
13 |
+
<div id="dialogueContainer">
|
14 |
+
<!-- 这里将显示选定的对话框页面的内容 -->
|
15 |
+
</div>
|
16 |
+
|
17 |
+
<script>
|
18 |
+
// 文件名的前缀和总数
|
19 |
+
var prefixes = ["dialogue-"];
|
20 |
+
var totalFiles = 19;
|
21 |
+
var totalFiles_1 = 6;
|
22 |
+
var totalFiles_2 = 2;
|
23 |
+
// 获取选择框元素
|
24 |
+
var selectElement = document.getElementById('dialogueSelector');
|
25 |
+
// 动态生成选项
|
26 |
+
for (var j = 0; j < prefixes.length; j++) {
|
27 |
+
for (var i = 0; i <= totalFiles; i++) {
|
28 |
+
for (var k = 0; k <= totalFiles_1; k++) {
|
29 |
+
for (var l = 0; l <= totalFiles_2; l++) {
|
30 |
+
var option = document.createElement('option');
|
31 |
+
option.value = prefixes[j] + i + "-" + k + "-" + l + '.html';
|
32 |
+
option.textContent = prefixes[j] + i + "-" + k + "-" + l;
|
33 |
+
selectElement.appendChild(option);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
function loadDialogue() {
|
39 |
+
var selectedValue = selectElement.value;
|
40 |
+
var dialogueContainer = document.getElementById('dialogueContainer');
|
41 |
+
// 使用 Fetch API 异步加载选定的对话框页面
|
42 |
+
fetch(selectedValue)
|
43 |
+
.then(response => response.text())
|
44 |
+
.then(data => {
|
45 |
+
// 将页面内容设置为对话框容器的innerHTML
|
46 |
+
dialogueContainer.innerHTML = data;
|
47 |
+
})
|
48 |
+
.catch(error => console.error('Error loading dialogue:', error));
|
49 |
+
}
|
50 |
+
// 页面加载时默认加载第一个对话框页面
|
51 |
+
loadDialogue();
|
52 |
+
</script>
|
53 |
+
|
54 |
+
</body>
|
55 |
</html>
|