如何将我输入的问题,展示在html页面上,只能使用html+js
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>问题展示</title>
<link rel="stylesheet" href="styles.css">
<script src="script.js"></script>
</head>
<body>
<h1>问题展示</h1>
<form>
<label for="question">问题:</label>
<input type="text" id="question" name="question"><br><br>
<button type="button" id="submit-button">提交</button>
</form>
<div id="result"></div>
<script>
// 获取表单元素
const question = document.getElementById("question");
const submitButton = document.getElementById("submit-button");
// 提交表单
submitButton.addEventListener("click", function() {
// 获取表单数据
const questionData = question.value;
// 提交表单数据到服务器
fetch("/submit-question", {
method: "POST",
body: JSON.stringify({
question: questionData
})
})
.then(response => {
if (response.ok) {
alert("提交成功!");
} else {
alert("提交失败,请重试!");
}
})
.catch(error => {
alert("提交失败,请重试!");
});
});
</script>
</body>
</html>
```