Javascript html中的Copy命令,用于chrome复制多个文本框
我正在创建一个便笺簿,以帮助用户之间保持便笺的一致性。我无法将多个文本框复制到字符串中。我已经附上了我所有的Java脚本 复制按钮,我想用它将多个文本框链接成一个文本字符串。重置按钮用于清除页面,复制按钮跟随非空文本框复选框。请帮助我将字符串复制到剪贴板 我在java脚本上尝试了许多不同的站点,但都没有成功。我还回顾了堆栈溢出,看看是否可以找到一个接近的项目 input type="button" id="BtnSupSubmit" value="Copy" onclick="notEmptySup()" style="width: 87px"Javascript html中的Copy命令,用于chrome复制多个文本框,javascript,html,Javascript,Html,我正在创建一个便笺簿,以帮助用户之间保持便笺的一致性。我无法将多个文本框复制到字符串中。我已经附上了我所有的Java脚本 复制按钮,我想用它将多个文本框链接成一个文本字符串。重置按钮用于清除页面,复制按钮跟随非空文本框复选框。请帮助我将字符串复制到剪贴板 我在java脚本上尝试了许多不同的站点,但都没有成功。我还回顾了堆栈溢出,看看是否可以找到一个接近的项目 input type="button" id="BtnSupSubmit" value="Copy" onclick="notEmptyS
你拥有的大部分都是多余的。见下面的评论: //获取对表单的引用 设frm=document.querySelectorform //为表单设置sumbit事件处理程序 frm.addEventListenersubmit,函数EVT{ //只需获取本地格式化的时间 var消息=时间:+new Date.toLocaleTimeString+ \n***主管升级***\n\n; //获取所有输入元素 让输入=document.querySelectorAllinput; //绕过去 forlet i=0;i
function settime() {
var curtime = new Date();
var curhour = curtime.getHours();
var curmin = curtime.getMinutes();
var time = "";
if (curhour == 0) curhour = 12;
time = (curhour > 12 ? curhour - 12 : curhour) + ":" +
(curmin < 10 ? "0" : "") + curmin + ":" +
(curhour > 12 ? "PM" : "AM");
document.date.clock.value = time;
clock = time
window.status = time
}
function notEmptySup() {
var myTextField = document.getElementById('TxtBoxCallersName');
if (myTextField.value != "") notEmptySup2()
else
alert("Please enter callers name.")
}
function notEmptySup2() {
var myTextField = document.getElementById('TxtBoxSupIssue');
if (myTextField.value != "") notEmptySup3()
else
alert("Please enter the reason for the escalation.")
}
function notEmptySup3() {
var myTextField = document.getElementById('TxtBoxSupAction');
if (myTextField.value != "") notEmptySup4()
else
alert("Please enter the action you took to help the customer.")
}
function notEmptySup4() {
var myTextField = document.getElementById('TxtBoxSupResolution');
if (myTextField.value != "") CreateMessage()
else
alert("Please enter the resolution of the call.")
}
function CreateMessage() {
strMessage =
"Time: " + clock + "\|" +
"***Supervisor Escalation" + "\***|" +
"Caller: " + document.getElementById("TxtBoxCallersName").value + " \| " +
"Reason: " + document.getElementById("TxtBoxSupIssue").value + " \| " +
"Action: " + document.getElementById("TxtBoxSupAction").value + " \| " +
"Resolution: " + document.getElementById("TxtBoxSupResolution").value + " \| " +
"Ticket Number: " + document.getElementById("TxtBoxSupTicketNumber").value + " \| " +
"Addl Notes: " + document.getElementById("TxtBoxSupNotes").value;
document.getElementById("hdnBuffer").value = strMessage;
var buffer = document.getElementById("hdnBuffer").createTextRange();
buffer.execCommand("Copy");
}