[英]Unable to get copy text into clipboard
I am using this for copying text into clipboard.. 我正在使用它来将文本复制到剪贴板中。
http://www.steamdev.com/zclip/
I have tried like this, but I am unable to get the copied text into clipboard.. 我已经尝试过这种方法,但是无法将复制的文本放入剪贴板。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/jquery.zclip.js"></script>
<script>
$(document).ready(function(){
$('textarea#showthis').zclip({
path:'js/ZeroClipboard.swf',
copy:function(){return $('#showthis').val();}
});
});
function myfunc2()
{
var selectedobj=document.getElementById('showthis');
if(selectedobj.className=='hide')
{ //check if classname is hide
selectedobj.style.display = "block";
selectedobj.readOnly=true;
selectedobj.className ='show';
} else {
selectedobj.style.display = "none";
selectedobj.className ='hide';
}
}
</script>
</head>
<body>
<label onclick="myfunc2()">Click here</label>
<textarea id="showthis" style="display:none" class="hide" readonly>hi, how are you?</textarea>
</body>
</html>
Please tell me what went wrong! 请告诉我出了什么问题! (I am not aware of javascript and jquery stuff!)
(我不知道javascript和jquery的东西!)
function myfunc2() {
if($('#showthis').css('display') == 'none'){
$('#showthis').show().removeClass('hide').addClass('show');
}else{
$('#showthis').hide().removeClass('show').addClass('hide');
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.