|
<!DOCTYPE html> |
|
<html lang="en"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title>选择对话框页面</title> |
|
</head> |
|
<body> |
|
|
|
<label for="dialogueSelector">选择对话框:</label> |
|
<select id="dialogueSelector" onchange="loadDialogue()"></select> |
|
|
|
<div id="dialogueContainer"> |
|
|
|
</div> |
|
|
|
<script> |
|
|
|
var prefixes = ['dialogue-4-', 'dialogue-3.5-']; |
|
var totalFiles = 9; |
|
|
|
|
|
var selectElement = document.getElementById('dialogueSelector'); |
|
|
|
|
|
for (var j = 0; j < prefixes.length; j++) { |
|
for (var i = 0; i <= totalFiles; i++) { |
|
var option = document.createElement('option'); |
|
option.value = prefixes[j] + i + '.html'; |
|
option.textContent = prefixes[j] + i; |
|
selectElement.appendChild(option); |
|
} |
|
} |
|
|
|
function loadDialogue() { |
|
var selectedValue = selectElement.value; |
|
var dialogueContainer = document.getElementById('dialogueContainer'); |
|
|
|
|
|
fetch(selectedValue) |
|
.then(response => response.text()) |
|
.then(data => { |
|
|
|
dialogueContainer.innerHTML = data; |
|
}) |
|
.catch(error => console.error('Error loading dialogue:', error)); |
|
} |
|
|
|
|
|
loadDialogue(); |
|
</script> |
|
|
|
</body> |
|
</html> |
|
|