console
function copyText() {
const textInput = document.getElementById('textInput');
const originalText = textInput.value;
const TextArr = originalText.split("*");
const appendedText = arrTostring(TextArr);
navigator.clipboard.writeText(appendedText)
.then(() => {
console.log('文本已成功复制到剪贴板!');
})
.catch(err => {
console.error('无法复制文本: ', err);
});
}
function arrTostring(TextArr) {
let temp = []
TextArr.forEach(element => {
temp.push(`ffmpeg -i .\\${element}.wmv -c:v h264_nvenc -preset slow -cq 38 -filter:v fps=fps=5 -c:a aac ${element}_转.mp4`);
});
return temp.join(" & ");
}
<div class="container">
<input type="text" id="textInput" placeholder="请输入要复制的文本">
<button onclick="copyText()">复制文本</button>
</div>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f4f4f9;
}
.container {
text-align: center;
background-color: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
input[type="text"] {
width: 80%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
padding: 10px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}