<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>替换文本框内容</title>
</head>
<body>
<input type="text" id="input1" placeholder="输入框1">
<input type="text" id="input2" placeholder="输入框2">
<input type="text" id="input3" placeholder="输入框3">
<button onclick="replace()">替换内容</button>
<script>
function replace() {
var input1 = document.getElementById("input1").value;
var input2 = document.getElementById("input2").value;
var input3 = document.getElementById("input3");
// 将输入框1中的特殊字符进行转义
var regex = new RegExp(input1.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g');
var text = input3.value;
text = text.replace(regex, input2);
input3.value = text;
}
</script>
</body>
</html>