<!DOCTYPE html>
<html>
<head>
<body>
<title>html注释</title>
<meta charset="utf-8">
<input type="text" id="inputBox" placeholder="请输入内容">
<button onclick="convertInput()">转换</button>
</body>
<script>
function convertInput() {
// 获取输入框内容
var input = document.getElementById("inputBox").value;
// 清除注释
var output = input.replace(/<!--[\s\S]*?-->/g, "");
// 转换后将结果写入到输入框中
document.getElementById("inputBox").value = output;
}
</script>
</head>
</html>