JS获取剪贴板内容的代码:
<Script Language="JavaScript">
var content = clipboardData.getData("Text");
if (content!=null) {
document.write("<center><font size=5 color=red>WARNING, TEXT RETRIEVED:</font> (see below)<br><br><span style='background-color: #FFFF00'>");
document.write(content);
document.write("</span>");}
else {
document.write('<center>No text found in clipboard. This is a good thing!<br><br>Works with Internet Explorer and Netscape.');
}
</Script>
<Script Language="JavaScript">
var content = clipboardData.getData("Text");
if (content!=null) {
document.write("<center><font size=5 color=red>WARNING, TEXT RETRIEVED:</font> (see below)<br><br><span style='background-color: #FFFF00'>");
document.write(content);
document.write("</span>");}
else {
document.write('<center>No text found in clipboard. This is a good thing!<br><br>Works with Internet Explorer and Netscape.');
}
</Script>
本文介绍了一段JavaScript代码,该代码能够在浏览器环境中(如Internet Explorer和Netscape)读取并显示剪贴板中的文本内容。此方法利用了`clipboardData`对象的`getData`方法来获取剪贴板数据。
3816

被折叠的 条评论
为什么被折叠?



