代码拉取完成,页面将自动刷新
同步操作将从 XE/xe-clipboard 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">
<title>剪贴板测试页面</title>
<script src="https://cdn.jsdelivr.net/npm/xe-clipboard" async></script>
<style type="text/css">
.copy-status {
height: 60px;
text-align: center;
font-size: 20px;
font-weight: 700;
}
.copy-status>span {
display: none;
}
.copy-status.success {
color: green;
}
.copy-status.success>.success {
display: block;
}
.copy-status.error {
color: red;
}
.copy-status.error>.error {
display: block;
}
</style>
</head>
<body>
<noscript>
<strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div>
<div class="copy-status">
<span class="success">Copy success.</span>
<span class="error">The browser is not supported.</span>
</div>
<button class="btn1">复制到内容111</button>
<input type="text" value="复制到内容222">
<button class="btn2">复制</button>
<input type="text" value="剪贴内容333">
<button class="btn3">剪贴</button>
</div>
<script>
(function () {
var showtimeout
function copyEvent (text) {
clearTimeout(showtimeout)
if (XEClipboard.copy(text)) {
document.querySelector('.copy-status').className = 'copy-status success'
} else {
document.querySelector('.copy-status').className = 'copy-status error'
}
showtimeout = setTimeout(function () {
document.querySelector('.copy-status').className = 'copy-status'
}, 1500)
}
document.querySelector('.btn1').addEventListener('click', function (evnt) {
copyEvent(evnt.target.innerText)
})
document.querySelector('.btn2').addEventListener('click', function (evnt) {
let inpElem = evnt.target.previousElementSibling
copyEvent(inpElem.value)
})
document.querySelector('.btn3').addEventListener('click', function (evnt) {
let inpElem = evnt.target.previousElementSibling
copyEvent(inpElem.value)
inpElem.value = ''
})
})()
</script>
<script src="https://cdn.jsdelivr.net/npm/xe-utils" async></script>
<script src="https://cdn.jsdelivr.net/npm/xe-ajax" async></script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。